Just wanted to share a basic automation I use to keep track of my zigbee devices online/offline state.
Binary Sensor
- platform: template
sensors:
zigbee_offline:
value_template: >
{% set offline = states.zha | selectattr('state','eq','offline') | list %}
{{ offline | length >= 1 }}
friendly_name: 'Zigbee Devices Offline?'
entity_id: zha.bedroom_tv_lights,zha.frog_couch_backlight,zha.motion_sensor_closet,zha.motion_sensor_garage,zha.motion_sensor_hallway,zha.motion_sensor_kitchen,zha.motion_sensor_office,zha.motion_sensor_sensor_living_room,zha.open_close_sensor_back_door,zha.open_close_sensor_front_door,zha.open_close_sensor_garage_door,zha.open_close_sensor_garage_fridge,zha.open_close_sensor_livingroom_window_front,zha.water_sensor_kitchen,zha.zigbee_zwave_repeater_1,zha.zigbee_zwave_repeater_2
And here is the automation
- alias: Zigbee Device Offline
trigger:
- platform: state
entity_id: binary_sensor.zigbee_offline
to: 'on'
for:
minutes: 15
action:
- service: notify.pushbullet_notifications
data_template:
target:
- !secret pauls_secret_email
title: Zigbee Devices Offline
message: >
{% set offline = states.zha | selectattr('state','eq','offline') | map(attribute='name') | join(', ') %}
The following zigbee devices are offline: {{ offline }}