@Rmb , Thanks! i have overlooked that the “Sun Sets” and the “Sun Rise” cards do support a Variable. Do you know if it as limitation in the “number-variable”? I think you got the solutin for a workaround when the “Time is xxxx” card do not support it. As a notice, i have contacted Athom about supporting “number variable” in the “time is xxxx” card.
I do not focuse on the name, i focuse on the time. The time for “moon” do suit the needs, most of the year. If you look at my snip from “SunEvents”, it is just some minutes between the times “Dawn” and “Moon Set”, and that is a issue. Then the “night” time is to short, that is part of why i started the Topic. I do understand your opinion.
Just type in a number in stead of a variable and you will find out soon enough
Having a variable in the time card might be complicated, because it shall be incorporated in the process scheduler.
Or you can use the solution mentioned above by running a flow every 5 minutes and compare time points.
In about 30 days the moon rotates around the earth. So after 15 days moonrise is 12 hours later.
Yeah, i was hoping to avoid that @Peter_Kawa , do you have a opinion of the timerange when using a variable/entered time. If i recall correctly, you where involved in testing “entered time” at some point.
I do not really like that
But this is what you want Athom to build😉
@Rmb , That is correct Waiting for the reply
You might expect a “no”.
Not really, but i can understand that it willl take some time. Because if it would be a number, it would be “two- variables”, one for hours and one for minutes. If the support can be a string, it would be easier. Cross fingers.
As a afterthougth, they might think it is “to difficult” to use, and then do not wish to implement it.
No it is, as far as I could come up with.
There doesn’t seem a way to trigger a flow with a variable holding a timestamp.
This is AFAIK only possible with the already mentioned “Every x minutes” trigger.
I don’t see a disadvantage, as long as you don’t trigger a flow each and every second so to speak.
For your use case, the proposed once in 5 minutes will most probably do. Add a condition “it’s nighttime” (which is the “It’s daytime” card inverted) to stop the flow from checking the timestamp during daytime.
.
I have been trying though… but I can’t do without the every x minutes trigger.
So the flow concept below is just pretty useless to me.
But, maybe the flowcards used brings you to ideas (or questions)
Although having a variable to start a flow is a nice discussion, I don’t see any added value in switching on lamps at sun set plus or minus a few variable minutes, as the time between de sun events is just minutes. I switch on the lamps 10 minutes before sun set, and I notice that on cloudy days it should be 15 or even more minutes earlier. So using other sun events is a poor solution to me. On such days I just switch on the lamps manually, if required. Automation cannot take into account the way human beings are aware of physical phenomena.
In this time of the year, it is minutes. It changes, like anything else in this world. If you do not see the point and does it in another way, just do it like that, i do not care.
That is correct, gave me some ideas! Thank you
@Peter_Kawa
Nice work! After every 5 minutes you could add a delay of x seconds (x>5) to avoid clashing (higher CPU) with other triggers activities that happen on that exact minute.
But honestly, I think it is overkill.
In any case, I am still trying to get my head around why a 5 minute timestamp needs to match another saved timestamp (who is saving it?). I must be missing something.
Indeed. Hence the option with external light sensor.
? You should care. @Rmb makes excellent points about searching for a compromise.
Often with smart home flows we get stuck thinking in a fixed way and spend an enormous amount of time. We all experience it. Others who share alternatives contribute to this thread which is for the greater good of the community, not just you.
Me too. We are getting lost in technical details. And with time, you get timing/concurrency problems, so you have to program failsafe.
For me, using a variable time to switch on the light, the principle is as follows, something like a task scheduler:
1. Every day at 13:00 calculate the time to switch on the light, store it in variable SwitchOnTime
2. Every 5 minutes, check if ActualTime > SwitchOnTime
3. If so switch on lamp
4. Disable 5 minute task
That seems quite easy😁
Using this as a starting point, optimizations are possible, and technical choices shall be made during implementation. For example, in a task scheduler you just delete an executed task from the task list. Here you might use a variable to indicate of the task (switching on the light at a variable time) has been executed.
Edit: Cronjob is task scheduler: see [APP][Pro] CronJob - Trigger Flows with Cron Expressions
Exactly, that is the (partial) answer to the question asked by @Marius_Stensrod
The principle can work, but why would you do that? This is really inefficient.
To better solve it, let’s go back to the original question of turning on the lights at a certain time/ trigger event.
How do you (@Marius_Stensrod ) do the actual calculation of the time (in your formula)? Based on what inputs? Season? Latitude/Longitude? Luminance?
There are tons of options so better if you provide more information.
- If it is time, then calculate timetarget - now in seconds (HomeyScript or BLL) and set a Chronograph timer.
- if it is SunEvents or the time is in epochtime format
- Others
Agree. So a task scheduler shall be a system function. I don’t know yet how the Cronjob app is implemented, [APP][Pro] CronJob - Trigger Flows with Cron Expressions
Edit: Other solutions can be found by searching the App Store for “job” or “task” or “schedule”.
Thanx!
Actually I use a ‘better’ way to avoid multiple triggers on every, like, 5 or 15 or 60 minutes, or at midnight.
But imho it was too much detail information for this usecase.
Instead of ‘Every 5 minutes’ I use ‘every 301 seconds’ for instance.
For ‘every 1 days’ I use ‘the time is 0:02’ , or, if it needs to trigger at the end of the day: ‘the time is 23:59’
Thanks everyone for your inputs @Rrrr , @Rmb, @DirkH, @Peter_Kawa ,
After all the discussion and the reply from Athom, I ended up with a check every 60 minutes.
For those who are interested, my complete flow now looks like this (and i have deleted a app i do not need, as my intetion was):
The light goes on/off (not a part of the topic):
Variable Time-set and If ON-OFF at night is allowed (Partily part of the Topic):
The flow that turns off/on the lights at the middle of the night (Topic issue):
It is pretty impossible to follow the cards because i use tags from the different cards, and the text is in Norwegian (If anyone can point me in the direction of easily translate it, i would be pretty happy)
Again, thanks to everyone in this Topic and Athom, the inputs and thoughts on this forum is pretty amazing!
Kind Regards
Marius
YW!