Homey Community Forum

Run a flow twice a day?

This seems something totally simple but I think I’m missing something (and search isn’t working well for me)

I know i can do this with 4 flows or some logic or but I’m trying to keep it simple.

Flow 1 (ON) run at 4am and 5pm
Flow 2 (OFF) run at 8am and 10pm

Alternatively
Flow 1 turn on device at 4 and off at 8am
Flow 2 turn on device at 5pm and off at 10pm

Is there a way to do this in only 2 flows?

I am currently on the “every 30mins” then logic to test the time with or, but this seems overkill for a twice a day action?

Maybe :grinning:

When:
Every hour
And:
Time between 15:59and 16:01
or
Time between 16:59and 17:01
Than xy

For the off you can select else in the “Than” space

That’s sort of how I’ve set it up right now but every half hour as I need in-between in reality, but seems excessive?

When: every 30mins
And
Logic: time=04:00 or time=16:30
Then
On

Just seems running something every 30mins for a twice a day is excessive!

image
use the same flow for ON and with a delay OFF

That would send an off command every 30mins throughout the day tho right? Which would be even worse!

Yeah, that could work

Thought on that tho - is it as robust? I.e. if homey / the app crashes or there is a power cut in the 60mins will it have lost that timer?

Compared to say if a separate flow kicked in at a time?

That is right, but at the other end, how often does that happen, and how big is the problem than? It’s a choice, what is the problem, having 4 flows for this problem, it’s all about your choice. :wink:

1 Like

True. I’d like both :wink:

Just seemed that there might be a more simplistic way to manage repeat actions without having a time check run every 30mins! (or two if i need two flows)!

You can do the solution of Osorkon and instead of turning the lights on or off just set a boolean and let the change of the value be the trigger for the flow to turn off or on the device, this will not turn the device off or on every 30 min.

1 Like

Interesting. Will give this a try…
I have it set up as a virtual device anyway so presumably this will work the same as the logic

So the above does seem to work but I set up a notification and it’s getting triggered every 30mins (I guess as expected)
What I’d like to ensure its that I’m not sending duplicate commands over the network / internet when unnecessary - how can I confirm this?

send temporarely a notification with every ON and every OFF command and be supprized.

That’s what I did. I got a notification every half hour (because of course it’s getting to the Then statement once way or another)

I’m not sure how I would send one with every “command” to the device?

When you’re in the “Then…” section have set up a notification for “Turn on” and “Turn off”, then of course you will receive a notification every half hour.
In the time between 4:00 - 8:30 and 16:30 - 23:30 you will get a message that the Virtual Button has been turned on every half hour, in the remaining time that the Virtual Button has been turned off.
You can solve that problem with more flows and/or using variables, but that is not what you want.

It’s just a question of what is more important to you, to save system resources by triggering the flows only when they are needed, or a better overview of the flows.
Maybe it would be possible to realize your requirements via a script, but I have absolutely no knowledge of that.

I would do it with 2 flows (as you can only have 2 or`s)

The flows still would be triggerd every half hour, you cant do anything about it, but it wont finisched because its checking in the and/or part if the device is already on or of. So you wont get a notification every half hour.

Flow 1, switching on

Flow 2, switching off

You can actually have 3 ORs I believe (but not 4 which would be needed for one flow)

Just tested it. Can have and/or/or. So 3 in total

Silly really. Bit of an arbitrary block

Well yes and no, the more or’s the more complex and the higher probabilities on errors…

I find it better to maintain when you have smaller bits instead of one large chunck… at least in programming, the same principle I think is regarding the cards.