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: OH 4 Updates
Problem Statement
Often in home automation there is a need to track certain states that the system is in. Events occur to transition from one state to another state (e.g. at noon we transition to the AFTERNOON state). The collection of all the possible states and the transitions between events is called a “state machine”.
This design pattern illustrates some ways OH can implement very simple state machines.
One of the most common uses of a state machine like this is to trac…
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#start…
I hope someone can tell me the new format for my rule.