Hi All,
I have a Zigbee Door Contact that is part of an automation that should turn on the workshop lights (a Z-Wave switch) when the door is opened.
It is the 1st time I use more than one trigger (motion sensor as well as door contact).
I don’t understand if I have missed a setting or if this is just “as it is with cheap Zigbee sensor”, but the contact sensor does not trigger half the time. With the door already open and the light manually turned off I have had instances where closing the door turned on the light.
The automation code that was generated from the HA interface is :
alias: Atelier Lights ON-Got motion
description: ""
triggers:
- trigger: state
entity_id:
- binary_sensor.atelier_interior_door_contact_contact
from: "off"
to: "on"
- trigger: state
entity_id:
- binary_sensor.q_sensor_motion_detection
from: "off"
to: "on"
conditions: []
actions:
- type: turn_on
device_id: 94ff87dca5f9346db953da210cd8492e
entity_id: c87ce9c7a1bee6f5f841dd9d409b7388
domain: switch
mode: single
What I am not certain of is that for the contact sensor “true” indicates a closed (so door closed) and false indicates open, but when I sue the UI to build the automation it gives me the state change from “off” which would be closed to “on” open ? I am getting this correctly…so “on” would equal “false”.
I would guess that “on” means that the door is closed (so the contact sensor detects contact).
Contact sensors are sometimes quirky at state changes. For example, opening a door might trigger the contact sensor to quickly report a series like closed-open-closed-open, after which it won’t trigger again until another door action.
If that’s what’s happening, try inserting a “for:” delay on the trigger; say 1 second or so.
I wouldn’t go from “off” to “on” etc. Remove the from and just have the to. Door sensors can go to sleep and switch to unavailable which would stop your automation from working.
Example :
triggers:
- trigger: state
entity_id:
- binary_sensor.atelier_interior_door_contact_contact
to: "on"