i want to create a rule, that should fire an action on sunset, but not before 7pm.
What i tried:
rule "myRule"
when
Time cron “0 0 19 ? * *” or
Channel ‘astro:sun:934250e6:set#event’ triggered END
then
if((AstroSunData_Set_EndTime_TimeForSitemap.state as DateTimeType).calendar.before(__???)) {
return;
}
…
how do i create a datetime object that represents 7 pm?
If you also want a datetime object on your sitemap, you need to set two channels:
The “range channel”, already mentioned by @Schnicki, which can be triggered in rules and the “end time channel”, which creates the datetime for your sitemap.
In your case, both channels need to be configured like
I’m struggeling with this config. I use the same but it is not working. earliest and latest are ignored.
My config:
astro:sun:Minus30 [ geolocation=“xx,yy”, interval=600 ]
{
Channels:
Type rangeEvent : rise#event [
offset=-30,
earliest=“7:20”,
latest=“08:20”
]
}
This should work as following:
Current sun rise time: 7:29
Because of -30 Offset new sun rise time: 6:59
Because of earliest 7:20: event should be triggered 7:20
But event is triggered at 6:59, which looks like earliest is not working?
earliest AND latest in one trigger can’t work: the event gets triggered at 06:59, that’s it.
If you need another trigger at 07:20, add another astro thing and set it up for triggering at 07:20.
earliest for me means what is the earliest time the event should come
latest for me means what is the latest time the event will come
This is no really AND it is just like:
If the event in inside of earliest and latest the deliver original date
if it is outside deliver ealiest or latest.