sthiemt
(sthiemt)
May 8, 2018, 5:05pm
1
Hello everyone,
I want to create a rule that is opening the blinds when I arrive home. However, it should not open the blinds when it is already dark outside.
To realize that a use the astrobinding (with SUN as a thing) and the following items:
DateTime NightStart {channel="astro:sun:7a324540:night#start"}
and then I use this comparision:
if (now.isAfter(NightStart))
{....}
but i get a type missmatch. How do I convert “NightStart” so that this works.
Thanks for your help
-sthiemt
vzorglub
(Vincent Regaud)
May 8, 2018, 10:05pm
2
I suggest you use this design pattern:
[Edit] Adde link to Time of Day State Machine
For years now I’ve let this Design Pattern post get out of hand so I’m going to rein it in a bit now. It’s really expanded away from what it’s originally intended to be (i.e. a way to illustrate how to code a time based state machine) into a thread that is mostly about the example, Time of Day. It’s partially my fault for naming the thread “Time of Day”. But there are better alternatives for Time of Day in specific and time based state machines in g…
Good luck
rlkoshak
(Rich Koshak)
May 9, 2018, 12:52am
3
As the author of the link Vincent posted I agree with his suggestion.
However, your specific problem in the code you posted includes:
halloween
(Hallo Ween)
May 30, 2018, 11:06am
4
I have a working solution, but it is deprecated. Maybe it helps you.
Hi,
how can i compare a given time from the astro-binding with now?
I want to make a cron-job. Then the rule should compare, if now is before or after the astro-time and do different things.
Maybe conjob at 7 o´clock --> look if sunrise was already.
I now do this with 2 separate rules and a proxy item, but i think it should work with a simple compare, too?
This is my astro item:
DateTime Sonnenaufgang_Start "Sonnenaufgang [%1$tH:%1$tM]" <sunrise> (gAstro) { channel="astro:sun:home:rise#sta…
I hope someone can tell me the new format for my rule.