I have a lightswitch that I’m attempting to set up a timer to automatically turn it off and using the rule below “works”.
var Timer GarageTimer = null
rule "Garage Light Timer"
when
Item Garage_Lights changed from OFF to ON
then
if (Garage_Door.state==CLOSED) {
GarageTimer = createTimer(now.plusMinutes(15)) [|
Garage_Lights.sendCommand(OFF)
]
}
else
return;
end
The problem I’m running into is how to trigger the rule when the light is manually changed. The switch doesn’t support association groups so it doesn’t report any commands back to the controller when changed at the switch. If I trigger the switch through HabPanel, everything works great. It will eventually poll the switch to get the state but there is no state change so no rule trigger.
What would be the best approach to trigger a rule on a device that doesn’t report commands? Run it every minute? Or is there a way to trigger it when it gets polled?
Here’s the items file for my garage. As indicated, the switch does not send status updates when changed manually at the switch. OH does poll the device every 10 minutes to get the current status but it doesn’t register as an “change event” and the rule doesn’t trigger. If I change it through HabPanel or a sitemap, it does work.
//Lights
Switch Garage_Lights "Garage Lights" {channel="zwave:device:160f13919e9:node9:switch_binary"}
//Door
Contact Garage_Door "Garage Door [%s]" {channel="zwave:device:160f13919e9:node7:sensor_door"}
Number Garage_Door_Battery "Garage Door Battery [%d %%]" {channel="zwave:device:160f13919e9:node7:battery-level"}
Switch Garage_Door_Tamper "Garage Door Tamper" {channel="zwave:device:160f13919e9:node7:alarm_general"}
This is bad… I don’t know anything about Z-Wave, but in my understanding you should get Z-Wave Events directly as they happen via the binding? From a quick read on the doc (https://docs.openhab.org/addons/bindings/zwave/readme.html) polling is to ensure, that devices are still ONLINE. But an event should be in openHAB in real-time in my understanding?
So I would ensure at first, that the binding is working directly - perhaps your garage switch is too far away from your gateway and it doesn’t connect properly in the mesh? Some users here recommend e.g. some ZWave outlets nearer to the garage or something like this.