Im trying to setup a motion dect (via Zoneminder) to trigger a light. I see messages in the log file where the motion is toggling ON/ OFF, however, my newbie script is not turning on a light. Any help appreciated! THX.
Rules:
var Integer counter_patio_light = 0
rule "Motion Light ON Patio"
when
Item Patio_motion changed from OFF to ON
then
if (NightState.state = ON){
sendCommand(Gold_lamp, ON)
counter_patio_light = 2
}
end
rule "every minute"
when
Time cron "0 * * * * ?"
then
if (counter_patio_light > 0) counter_patio_light = counter_patio_light - 1
if (counter_patio_light == 1) sendCommand(Gold_lamp, OFF)
end
items:
Switch Patio_motion “switch” {channel=“zoneminder:monitor:94da2af1:monitor-2:alarm”}
Logfile:
[vent.ItemStateChangedEvent] - zoneminder_monitor_94da2af1_monitor_2_force_alarm changed from OFF to ON
[vent.ItemStateChangedEvent] - zoneminder_monitor_94da2af1_monitor_2_alarm changed from OFF to ON