Haven’t tested a door sensor, but the temp sensor from xiaomi and a switch and a lamp from IKEA when connected to zigbee2mqtt, they actually create a device in home assistant. So you can directly check the device instead of mqtt messages. For eg. the temp sensor in mine is sensor.0x00158d00036b744d_temperature.
In trigger i would put the sensor instead of the topic and check its’ state.
And here’s an automation eg. which I take data from a IKEA button and trigger a lamp. Both are zigbee2mqtt devices.
- id: ButtonLight
alias: Turn on stairlight when button is pressed
trigger:
- platform: state
entity_id: sensor.0x000d6ffffe1f896f_action
to: toggle
action:
- service: light.toggle
entity_id: light.0x000b57fffe9151b8_light
If you find out what your entities are named you just replace the entity_id and the to: to what the message is sent when the sensor triggers, On the action you just put service: script.turn_on and entity_id: script.kettle_on. This way it will only trigger when the sensor triggers open