1
0

Add Unavailable notice for Z-Wave devices

This commit is contained in:
Przemek Grondek 2023-12-15 14:04:10 +01:00
parent 285a0dff7b
commit 7f3407383a
5 changed files with 70 additions and 19 deletions

11
HELP.md
View File

@ -8,3 +8,14 @@
{% endfor %}
{{ ns.result }}
```
# List Z-wave entities fot checking unavailability
You need to enable node_status for each device, and they need to have `node_status` suffix
```
{% set ids = integration_entities('zwave_js') | select('search', 'node_status$') | unique | list %}
{% set ns = namespace(result=[]) %}
{% for s in ids %}
{% set ns.result = ns.result + [ [s, device_attr(s, 'name_by_user')] ] %}
{% endfor %}
{{ ns.result }}
```

View File

@ -1,18 +0,0 @@
- id: info_unavailable_notice
alias: '[INFO] Unavailable notice'
description: ''
mode: single
trigger:
# Kitchen tabletop motion (Z-Wave)
- platform: device
device_id: c7bb75d230dd4f8a5b7ece910f00c583
domain: zwave_js
type: state.node_status
entity_id: sensor.node_6_node_status
to: dead
action:
- service: notify.mobile_app_iphone
data:
title: "Device unavailable"
message: >
{{ device_attr(trigger.event.data.device_id, 'name_by_user') }} is unavailable

View File

@ -39,13 +39,24 @@
include_vars:
file: zha-devices.yml
name: zha
- name: Build unavailable automations
- name: Build unavailable automations ZHA
delegate_to: localhost
template:
src: unavailable-zha.yaml.j2
dest: './build/automations/unavailable-zha.yaml'
vars:
devices: "{{ zha.devices }}"
- name: Include Z-wave vars
include_vars:
file: zwave-devices.yml
name: zwave
- name: Build unavailable automations Z-Wave
delegate_to: localhost
template:
src: unavailable-zwave.yaml.j2
dest: './build/automations/unavailable-zwave.yaml'
vars:
devices: "{{ zwave.devices }}"
- name: Build spices shopping automations
delegate_to: localhost
template:

View File

@ -0,0 +1,16 @@
- id: info_zwave_unavailable_notice
alias: '[INFO][Z-Wave] Device offline'
mode: single
trigger:
- platform: state
to: dead
entity_id:
{% for device in devices %}
- {{ device.entity_id }} # {{ device.name }}
{% endfor %}
action:
- service: notify.mobile_app_iphone
data:
title: "Device unavailable"
message: >
{% raw %}{{ device_attr(device_id(trigger.event.data.device_id), 'name_by_user') }}{% endraw %} is unavailable

31
zwave-devices.yml Normal file
View File

@ -0,0 +1,31 @@
devices:
- name: '3D Printer'
entity_id: 'sensor.3d_printer_node_status'
- name: 'Kitchen tabletop motion'
entity_id: 'sensor.kitchen_tabletop_node_status'
- name: 'Dining Motion Sensor'
entity_id: 'sensor.dining_motion_sensor_node_status'
- name: 'Printer Switch'
entity_id: 'sensor.printer_switch_node_status'
- name: Siren Alarm
entity_id: 'sensor.siren_alarm_node_status'
- name: 'Kitchen Motion Sensor'
entity_id: 'sensor.kitchen_motion_sensor_node_status'
- name: 'Bathroom Thermostat'
entity_id: 'sensor.bathroom_thermostat_node_status'
- name: '3D Printer Smoke Sensor'
entity_id: 'sensor.3d_printer_smoke_sensor_node_status'
- name: 'Kitchen Big Light'
entity_id: 'sensor.kitchen_big_light_node_status'
- name: 'Doorbell'
entity_id: 'sensor.doorbell_node_status'
- name: Door Window Sensor
entity_id: 'sensor.door_window_sensor_node_status'
- name: 'Coffee machine leak'
entity_id: 'sensor.flood_coffee_machine_leak_node_status'
- name: 'AC Power'
entity_id: 'sensor.ac_power_node_status'
- name: 'Office Thermostat'
entity_id: 'sensor.office_thermostat_node_status'
- name: 'Dining Thermostat'
entity_id: 'sensor.dining_thermostat_node_status'