[SOLVED] What's right way how to work with astro data in rules?

Can somebody give me a hand how to write rules which are based on astro data?
Astrobinding have already all needed items, but how you are using them?
eg. I wanted some action 20mins BEFORE dusk, or xy mins before/after dawn.

I guess I cant do

   civildusk - 20 mins
   do stuff


All down to the end:

No, you can’t.
You can set up an Astro event thing that triggers 20 mins before dusk and trigger a rule from that.
Or you can link an Astro channel to a DateTime Item and examine that in a rule anytime you like, to see if dusk - 20 mins > now.

1 Like

You can do something like this (and do some calculation within the following <...>) to achieve what you want where <latitude> and <longitude> are the values for your geolocation:


astro:sun:home		[ geolocation="<latitude>,<longitude>", interval=60 ]

// +15° are equivalent to -60 minutes
astro:sun:minus30	[ geolocation="<latitude>,<longitude + 7.5>", interval=60 ]
astro:sun:minus45	[ geolocation="<latitude>,<longitude + 11.25>", interval=60 ]

For your example it is +5° for the longitude:

astro:sun:minus20	[ geolocation="<latitude>,<longitude + 5.0>", interval=60 ]

Then you can use the triggers as described (see channels in the binding documentation):

rule "action 20mins BEFORE dusk"
	Channel 'astro:sun:minus20:civilDusk#event' triggered START
	logInfo("astro.rules", "It is 20 minutes before civil dusk now!")
1 Like

wow sweet, haven’t thought about degrees can be represented as time and time difference.
That will do the job.

You are welcome! :smile: