Sunset minus 30 minutes

I have a bunch of lighting rules working fine in terms of triggering at sunset:

rule "Living Room Lamp ON"
	when
		Channel "astro:sun:local:set#event" triggered START
	then
		SmartSwitch2_Switch.sendCommand(ON)
end

My question is, how can I modify the trigger to turn on 30 minutes earlier? As its a bit dark by the time it all turns on.

Thanks

https://docs.openhab.org/addons/bindings/astro/readme.html#channel-config

1 Like

Create new item switch with offset, it will switch ON and immediately switch OFF - so then create a rule waiting for ON trigger on that new switch.

// switch will go on 10 minutes before sunset:
Switch Sunset_Time_10 {astro="planet=sun, type=set, property=end, offset=-10"}
rule "Living Room Lamp ON"
when
    Item Sunset_Time_10 received update ON
then
    SmartSwitch2_Switch.sendCommand(ON)
end 

Unfortunately that is the old item syntax for the astro1 binding. With the astro2 binding the offset is configured in the channel syntax.

Aaaaah, it seems that I did not update my Astro binding for ages :grinning: You are right, so sorry for any inconvenience caused using astro1 syntax in astro2 binding …

Did you find a solution that you can share ?

Use the “offset” option of your astro-thing for that.

astro:sun:timer  [ geolocation="xxxx,xxxx,xxx", interval=60 ] {
    Channels:
        Type rangeEvent : set#event [
            offset=-30
        ]
}

Then simply use that as a trigger for you event:

rule "Sunset-timer with offset"
when
    Channel "astro:sun:timer:set#event" triggered START
then
    ...
end
1 Like