How to start a flow at a spesific time stored in variabel, with built in functions (Solution - Check every 60 minutes)

Hello,

Does anybody have a suggestion on how to start a flow based on a time stored in a Variable, without the use of “SunEvents” app or any other apps besides the built in functions? I also do not want to have a flow running “every 5 minutes” or so, to check if variabel match the system time.

My case is, my outside lighting is going on/off based on median-lux or using the built in “Sunset/Sunrise function”, but i wish to turn off the lights some hours in the middle of the night. My thought was to add a time to the Sunset time, and the Sunrise time that Homey stores, if the times overlap each other, then i will not turn of the lights.

I am using “SunEvents” for only two trigger-cards today, and that is the “Moon set” and “Nautical Dawn”, but i wish to reduce the Memory consumption and uninstall the app, but the built in “Time” card, does not support a variabel.
I might got a App that can suite my needs, but not aware of it:


I also got a running RaspberryPi, if that one can be of some use to post a event of some kind, without the need of installing more apps on the HP.

Regards
Marius

What is your trigger?
WHEN there is movement
or
WHEN luminance changed

Why not add a card
AND it is not 00:00-05:00
or another equivalent card for night time?

Or do the opposite:
AND it is daytime or 06:00-18:00
or
AND it is after sunrise AND before sunset

Can you show your current flow?

Could you give some examples at which the time the lights shall be switched on and off, in case there is overlap and in case there is no overlap?

Without any of them, it might be difficult. There are potential solutions depending on when will the variable be set and how often it might be changed.
So you need at least the App Countdown, which is not built in but already installed in your system, or something similar.
Unfortunately Countdown knows only seconds, and I do not know what is the maximum there.
The idea is that you run
When… Every 1 days
Then… Start countdown timer VariableTime MySeconds
And another line in your advanced flow or an extra flow:
When… Timer reaches zero(0) VariableTime
Then… Switch your light on/off, etc
VariableTime is just my choice for the name of the Timer, and MySeconds is the variable keeping the chosen time in seconds.

If Countdown is limited in the seconds used, you might need something like Chronograph or start with every 1 hour and check the the hour before starting the seconds.

And if you want the time calculated or set during the day, you might need BetterLogicLibraray or something which is capable of calculating with time strings.

@Rrrr, @Rmb and @DirkH , Thanks for the different suggestions. Time is trigger.

Flow example:

I am capable of getting the correct time i want, and compare the two different (sunrise with offset and sunset with offset) times to determine if the “night off” function should operate or not. But the Time-trigger is my big case, the CountDown suggestion is not a bad idea.

When = “Time is string-variable” , is the option i am missing, and woundered if it was a workaround out there somewhere.

Time stamp is not the right trigger for sure. You have two sun events as trigger.

Can you do Google translate in your web page so it’s easier to read your cards?

There are various work arounds for you, but it’s better to show you one that fits your flow model

From this technical detailed (and perhaps not yet correct) flowchart, it is too difficult for me to understand your goal. So I give the floor to @Rrrr an @DirkH :grin:

Great.
So taking what has been written before:

Solution A:
If you want to remove the app, I think that you will find a close compromise if you focus on the native sun cards.

Sunrise and sunset and the average time you have in your country (for more sophistication you can specify an AND with the months):

  • before sunrise
  • after sunset
Period Day
time
Night
time
Degrees sun below horizon Period starts at Period ends at Amsterdam
3 Jun 2019
Astronomical twilight V 12-18 degrees Astronomical dawn Nautical dawn 00:00-03:22
Nautical twilight V 6-12 degrees Nautical dawn Civil dawn 03:22-04:35
Civil twilight V 0-6 degrees Civil dawn Sunrise 04:35-05:23
Daylight V - Sunrise Sunset 05:23-21:54
Civil twilight V 0-6 degrees Sunset Civil dusk 21:54-22:42
Nautical twilight V 6-12 degrees Civil dusk Nautical dusk 22:42:23:56
Astronomical twilight V 12-18 degrees Nautical dusk Astronomical dusk 23:56-00:00
Nightlight V >18 degrees Astronomical dusk Astronomical dawn 00:00-
4 jun 2019

For example:

Thanks for the suggestion, the timer solution might be the best solution, with different timers depending on the Month of the year.

The alternative is a simple (Philips Hue) outdoor motion/luminance sensor on your roof.

Works great too on dark, rainy days

What good would that do? I already got Median-lux reading (as mentioned before) from two different sensors.

I lost you there. Maybe I misunderstood your issue. If you have exact sensors that trigger a flow, why work with Sun Events?

@Rrrr , yes, i tried to describe it as good as possible, but something maybe godt lost in “translation”.

Who needs lights outside when the house are sleeping?

My previous snip was only a small part of the “outside light flows”. It was a snip of my reason to make the topic, to get some more ideas.

I had the idea that in summer nights you want to have lights on during the short night. But in wintertime only at the beginning of the evening and early in the morning. And switch them of in the middle of the night.

1 Like

Sounds about right :+1::ok_hand:

I am not really sure, what you want as I do not understand nautical dawn and why it is related to the moon, as the moon can rise or set at any time during day or night.
But do not combine events, if you have to decide afterwards, which event was started. Just keep the two events separated and duplicate the card that it has to be between Saturday and Monday. Then you can avoid asking again, if it is moon set or nautical dawn.

1 Like

No worries, but you did not use sensor readings in your flow anywhere.

I assumed your lux sensors were not sensitive enough to measure twilight.

But in that case (a little beyond the scope of your question) you can create amazing flows that can also be tweaked for when it’s dark in daytime and motion/presence.

I’ll assume you have some of that covered.

Solution B
Twilight approximation

Generic
WHEN lux becomes smaller than 50
Then turn lights on

WHEN lux becomes greater than 55
Then turn lights off

Part 1 Night twilight
WHEN lux changed
AND lux < 5
AND it’s after 22:00
AND lights are on
THEN turn off

WHEN it’s 23:00
AND lights are on
THEN turn off

Part 2 Morning twilight
WHEN lux changed
AND lux > 0 AND < 55
AND it’s after 04:00
AND lights are off
THEN turn on

According to your region you will have to tweak.

Note:
“WHEN lux becomes greater/smaller than”
will fire less often.

The below uses more CPU but you may need to work with it in a limited time period:
WHEN lux changed
AND lux < xx
AND time between x and y

It is actually not combined. The “logic card’s” separates the functions.

That is because i have only shared my issue, and that is not to turn on or off the lights based on LUX/Luminance, Sunrise/Sunset and so on. The flow works good, as it is, it is used to turn off and on the lights in the middle of the night. But i want to replace the “SunEvent” cards with a App i already have or the Native/built in functions Homey offers, to free up memory on the HP.

To clarify with SunEvents Cards:
image

WHEN - Sunset = Light ON
WHEN - Dawn = Light OFF
WHEN - Moon Set = Light ON
WHEN - Sunrise = Light OFF

The Times for Dawn and MoonSet, do i wish to replace with a calculated offset on the “Sunset” and “Sunset” that Homey stores. I do still want to use time as a trigger, but the Native/Built in functions does not support a “Variable/Tag” and i am in search for a “workaround”, so i can delete the “SunEvents” app. If Homey supported “Variable/Tag” in the “Time is xxxx” card, the issue would be solved. But because it is a community, and not the Homey development, i am in search of a workaround :slight_smile:

Maybe this gives you enough flexibility:


A variable time to advance and a fixed time to delay.

Or you run a flow every 5 minutes AND calculate if the time is a variable X minutes before or after sunset/sunrise.

PS: it is very confusing to use moon events to switch on or off a lamp, because a moon event is not a sun event. But eventually you will find out yourself.