Hi,
I have a hard time getting Astro offsets to work.
Here is what I want to acheive:
- Variable offset of sunrise (± 60min) - I’m trying to offset Astro sunrise -60min and then just set a timer with my variable offset when the start event is triggered that will execute on the point in time
- Variable offset of sunset (± 60min) - same as above but triggering on the sunset end event and I’m offseting whole thing -120 minutes because I want to turn lights on with offset (±60min) related to “my” sunset
example scenario:
- Astro sunrise with -60min offset: 05:45 (without offset 6:45)
- My sunrise offset: -15 minutes
- 05:45 sunrise#start gets triggered and sets a timer for (60-15)minutes from now
- 06:30 timer code executes
- Astro sunset with -120min offset: 16:45 (without offset 18:45)
- My sunset offset: +15 minutes
- My light offset: -20 minutes
- 16:45 sunrise#end gets triggered and sets timers:
- (120+15)minutes from now (“stuff” timer)
- (120+15-20)minutes from now (light timer)
- 18:40 the light timer code executes
- 19:00 the “stuff” timer code executes
Here is my .thing
definition:
Thing astro:sun:coopLocation [ geolocation="aaa,bbb,100" ] {
Channels:
Type rangeEvent : rise#event [
offset=-60
]
Type rangeEvent : set#event [
offset=-120
]
}
this doesn’t seem to affect the date in my items and logs show that sunrise#start
gets triggered without the -60 minutes offset (same goes for the sunset)
sunset .items
:
DateTime Sunrise "Sunrise raw [%1$tH:%1$tM]" <sun> { channel="astro:sun:coopLocation:rise#start" }
that item in the .sitemap
:
Default item=Sunrise
I have tried to change thing definition to:
Type rangeEvent : rise#start [
or
Type start : rise#start [
but no success there too at one opint I got to work displaying the offset time (it was showing 5:45 instead 6:45) but the event triggered without this offset
Here is the rule that I use for sunrise (sunset is basically the same)
rule "Sunrise - prepare"
when
Channel "astro:sun:coopLocation:rise#event" triggered START
then
logInfo( "coop.rules", "sunrise !")
createTimer( now.plusMinutes( 60 + Integer::parseInt( SunsetOffset.state.toString ) ), [
//SunsetOffset is my variable offset
logInfo( "coop.rules", "Doing stuff on the offset sunrise!")
SunriseReady.sendCommand( ON )
])
end
The timers are executing without any problems (so far) - the problem is that the Astro events are triggered without offsets.
I think I might be missing something obvious but apparently I’m blind and just I cant see it
Edit:
I didn’t really change anything and code started working I promably had a typo somewhere?