This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
Closed
Flow between two times
I'm probably overlooking something and the search function is not being very helpfull either. I want to create a simple flow that will switch a socket on if it's 17:00 and switch it back off again if it's 23:00. As it looks I'm gonna need two flows for this but I'd like to do this in a single flow to keep things clean.
This discussion has been closed.
Comments
Now I'm digging into the flows I run into similar questions. What I seem to miss is some sort of exit criteria. If I compare it with Tasker, a automation plugin for Android, you can trigger a action of a specific event but you can also set a action once the event is no longer valid (for instance, turn on GPS when application Maps is running, once Maps is shut down the GPS is disabled again as well). Would be great to have similar functionality with the Homey Flow™ .
if time is 17:00 set LightsOn to true
if time is 23:00 set LightsOn to false
if lightson is changed, pass bool value to switch (socket)
Then, let the socket turn on on true and turn off on false.
The big advantage is that you now also can add a button of a remote in a flow
If button X is pressed flip the bool value of LightsOn (true to false or false to true).
(ps, trying to make this)
Some options to better manage flows would be a folder structure to manage flows and have a function to duplicate a flow. I'm sure the developers have some good ideas themselves. So far I'm really impressed at the how the UI works. It's absolutely beautiful. It will take time to further develop flow management features.
Uranday: You can use variables. I generally use integer values.
As I describe here: https://forum.athom.com/discussion/comment/9606/#Comment_9606 I prefer to separate my "Events" from "Actions".
Here is an example how to "toggle" the lights and use timers. This example can be easily extended with more "Event triggers". Also, instead of controlling one light, you can set multiple lights to a specific "scene".
Timer:
IF time = 19:00 THEN set LightsOn to 1
IF time = 23:00 THEN set LightsOn to 0
Remote:
IF button was pushed AND LightsOn is 0 THEN set LightsOn to 1
IF button was pushed AND LightsOn is 1 THEN set LightsOn to 0
Note: you need both flows, one setting 0 to 1 and the other setting 1 to 0.
Execute Action:
IF LightsOn changed AND LightsOn = 1 THEN turn lights on
IF LightsOn changed AND LightsOn = 0 THEN turn lights off
Simple, Elegant, Beautiful... I love my Homey...
Bonus feature:
You can use this pattern to cycle though colors with your remote by using more numbers:
Remote: 0 -> 1, 1 -> 2, 2 -> 3, 3 -> 0
Execute action: 0 = off, 1 = red, 2 = green, 3 = blue.
The possibilities are endless.
I have multiple "Timer" and "Execute" flows based on different variables. For instance:
What I'm experiencing is that the execute flow that listens to the variable "mediaOff" gets triggers when the variable "lightsOff" is changed. So at 23:00 both my lights and media is switched off. I have gone over my flows a couple of times and all looks to be configured correctly, so seems like a bug to me. Can you perhaps confirm this?
The variable lightsOff and mediaOff set and reset each other.
Edit
If I make lightsOff 5 instead of 1 mediaOff become also 5.
https://github.com/athombv/homey/issues/182
IF button was pushed AND LightsOn is 0 THEN set LightsOn to 1
IF button was pushed AND LightsOn is 1 THEN set LightsOn to 0
Wouldn't your Remote Actions run both, switching LightOn to 1 (first line), then to 0 again in the second line?
I would change the remote to:
IF button was pushed THEN set LightsOn to 1-LightsOn
or, in the multiple colorcycling version (say: LightsOn 0,1,2, or 3):
Set LightsOn to LightsOn+1
IF LightsOn > 3 THEN set LightsOn to 0
Also, I noticed that a KaKu remote triggered the flow twice. The "variable changed" flow is however only triggered once. This seems to be a nice feature to prevent infinite loops.
Toobad that Homey takes so long to process speech, otherwise I was going to build an English butler (Jeeves) with some random functions and quite a bit of conversation.
Such as "Jeeves, I am going to sleep"
"Very well Sir, I will switch off the lights in the living as soon as you left" "Wake up at (+8 hours)?" You have your first appointment with Mrs. So and So at 10:00, but it will take an estimated 3 hours by car or 4 hours by train. Also their is construction work going on and local freezing may cause additional delays" " May I wish you a pleasant night, Sir?"
etc. etc.