I have a doorbell setup with a Tradfri switch (also tried with Aqara switch), Zigbee2MQTT, automation and scripts triggering notifications. It all works fine when I am testing and finetuning. However, I noticed that after a certain period of time (don’t know exactly but at least 1 hour) the switch device is offline and not publishing to Zigbee2MQTT when pressed. What I noticed from the logs is that in such case the device is announcing itself and after a few seconds when I press the button again, it triggers the automation correctly.
zigbee2mqtt:info 2020-05-01 09:30:42: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"device_announced","message":"announce","meta":{"friendly_name":"tradfri_switch_1"}}'
zigbee2mqtt:info 2020-05-01 09:31:26: MQTT publish: topic 'zigbee2mqtt/tradfri_switch_1', payload '{"linkquality":21,"update_available":true,"battery":74,"click":"on"}'
zigbee2mqtt:info 2020-05-01 09:31:26: MQTT publish: topic 'zigbee2mqtt/tradfri_switch_1', payload '{"linkquality":21,"update_available":true,"battery":74,"click":""}'
zigbee2mqtt:info 2020-05-01 09:31:26: MQTT publish: topic 'homeassistant/device_automation/0x14b457fffe64f74c/click_on/config', payload '{"automation_type":"trigger","type":"click","subtype":"on","payload":"on","topic":"zigbee2mqtt/tradfri_switch_1/click","device":{"identifiers":["zigbee2mqtt_0x14b457fffe64f74c"],"name":"tradfri_switch_1","sw_version":"Zigbee2mqtt 1.13.0","model":"TRADFRI ON/OFF switch (E1743)","manufacturer":"IKEA"}}'
zigbee2mqtt:info 2020-05-01 09:31:26: MQTT publish: topic 'zigbee2mqtt/tradfri_switch_1/click', payload 'on'
Does someone know how I can make sure that the automation is always triggered? The doorbell is useless when going offline after some time.