I’m trying to think how to make a rule that will trigger only if an item status didn’t change for 5 minutes.
what I have so far is this (I want it to turn off if b836405c was ‘false’ for 5 minutes):
rule "PC light auto on or off"
when
Item mqtt_topic_b836405c_occupancy received update
then
if (mqtt_topic_b836405c_occupancy.state == 'true'){
tradfri_0220_0004c4ab_65537_brightness.sendCommand(100)
tradfri_0220_0004c4ab_65537_color_temperature.sendCommand(35)
}
if (mqtt_topic_b836405c_occupancy.state == 'false'){
if (mqtt_topic_b836405c_occupancy.historicState(now.minusMinutes(5))=='false' && mqtt_topic_b836405c_occupancy.historicState(now.minusMinutes(4))=='false' && mqtt_topic_b836405c_occupancy.historicState(now.minusMinutes(3))=='false' && mqtt_topic_b836405c_occupancy.historicState(now.minusMinutes(2))=='false' && mqtt_topic_b836405c_occupancy.historicState(now.minusMinutes(1))=='false'){
tradfri_0220_0004c4ab_65537_brightness.sendCommand(OFF)
}
}
end
There’s got to be a better way to do this.
Any help and ideas will be appreciated.