I have the rule below setup, but as the subjects it’s not working as I’d expect.
The lights switch on and off as required but the Back_Garden_Status item is not being updated for some reason. Can anyone offer me an explanation?
rule "Back Garden Entry Motion Open"
when
Item Back_Garden_Entry_Motion_Sensor changed from CLOSED to OPEN
then
postUpdate(Back_Garden_Entry_Motion_Sensor_Last_Activation, new DateTimeType())
if(Back_Garden_Exit_Motion_Sensor.state == "OPEN") {
postUpdate(Back_Garden_Status, "Leaving")
}
if(Living_Room_Illumination_Sensor_Lux_Level.state < 150) {
sendCommand(Back_Garden_Lights, ON)
}
end
rule "Back Garden Entry Motion Closed"
when
Item Back_Garden_Entry_Motion_Sensor changed from OPEN to CLOSED
then
sendCommand(Back_Garden_Lights, OFF)
end
rule "Back Garden Exit Motion Open"
when
Item Back_Garden_Exit_Motion_Sensor changed from CLOSED to OPEN
then
postUpdate(Back_Garden_Exit_Motion_Sensor_Last_Activation, new DateTimeType())
if(Back_Garden_Entry_Motion_Sensor.state == "OPEN") {
postUpdate(Back_Garden_Status, "Entering")
}
if(Living_Room_Illumination_Sensor_Lux_Level.state < 150) {
sendCommand(Back_Garden_Lights, ON)
}
end
Here’s the events.log entries from me testing.
2017-12-05 16:16:08 - Back_Garden_Exit_Motion_Sensor state updated to OPEN
2017-12-05 16:16:08 - Back_Garden_Exit_Motion_Sensor_Last_Activation state updated to 2017-12-05T16:16:08
2017-12-05 16:16:09 - Back_Garden_Lights received command ON
2017-12-05 16:16:09 - HueTapEventType state updated to 4002
2017-12-05 16:16:09 - HueTapEventWhen state updated to 2017-12-04T22:32:00
2017-12-05 16:16:09 - HueTapReachable state updated to true
2017-12-05 16:16:11 - Back_Garden_Entry_Motion_Sensor state updated to OPEN
2017-12-05 16:16:11 - Back_Garden_Entry_Motion_Sensor_Last_Activation state updated to 2017-12-05T16:16:11