Simple rule, clearly not

Hi All

I created an offset event which appears to work, 20mins before Sunset.

Its meant to turn on the motion sensor and on the lights, but nothing is occuring nor do I see any errors in the log.

the if statement checks a proxy item, so I can disable the rule if need be but it appears to not trigger any events. Even if this proxy is OFF, it should still enable the Motion sensor.


rule "Turn on harbour side lights at 20mins prior to sunset"
when
        Channel 'astro:sun:sunset20mins_before' triggered START
then
        MasterBed_Motion_Armed.sendCommand(ON)
        Sunset.postUpdate(OFF)
        if(HarbourLights_BeforeSunset.state == ON){
                RearGarden_Sw1.sendCommand(ON)
                Entrance_Sw1.sendCommand(ON)
        logInfo("Lights","Turn on harbour side lights 20mins prior to sunset")
     }
end


2019-12-11 19:37:00.003 [vent.ChannelTriggeredEvent] - astro:sun:sunset20mins_before:set#event triggered START
2019-12-11 19:40:00.003 [vent.ChannelTriggeredEvent] - astro:sun:sunset20mins_before:set#event triggered END

I cannot see what Im doing wrong, any suggestions?

Thank you!

You must use the same trigger as the event log show (including #event).

2 Likes

Oh man! I’m so stupid. I stared at that code and could NOT work out why. Thanks Markus! I think thats it :wink: