I am attempting to use an Aqara Tilt Sensor to track when my garage door opens and closes. I would like to have a separate entity (aka binary_sensor) that has the current state of the Garage Door (Open, Closed).
How do I go about creating a trigger event (for zigbee2mqtt) so that when the Tilt sensor z state > X my binary_sensor sets itself to Open and when its <= X it set itself to closed?
I can find various posts on how to do this with ZHA, but not with zigbee2mqtt.
I know there is probably a couple different options here, I have tried a few , but haven’t been able to get it working yet.
When you say ‘tilt sensor’ are you referring to the Aqara Vibration Sensor (DJT11LM) which is only useful as a tilt sensor?
Did you see the example for the trigger in this thread?
I tried to use the tilt functionality to detect, if my garage door is open, opening, closing, or closed but did not react quickly enough for my use case.
Yes, the DJT11LM. That example looks just about what I want, but the “action” I want that numeric_state to do is set another entity to Open or Closed. So for example I can create a card on the homepage to view the garage status at all times.
So, you create the ‘other entity’ as a helper, e.g. a binary sensor/toggle, and use the trigger to switch it on and off. You can then display the binary_sensor e.g. in a glance card that can automatically color the icon according to the on/off/ status.
Or you can use a template to define a binary sensor to achieve the status change and then show the state in a card - this is how I show it in a custom button card:
Note that the last bit for the label is only to convert the upper case state info to the lower case in the button - mine is obviously NOT a real binary sensor because I want/need to show the opening and closing states as well.