I have a template sensor that is meant to give me the status of my z-wave network. It’s possible values are critical, severe, warning, minor, and ok. (I have several monitor type sensors that use these values)
Z-Wave status sensor
- sensor:
- name: "ZWave Status"
unique_id: zwave_status
icon: mdi:z-wave
state: >
{% if is_state('binary_sensor.zwave_network', 'off') %} critical
{% else %} {{ iif(states('sensor.offline_zwave_devices') | int(-1) > 0, 'warning', 'ok') }}
{% endif %}
The state of critical is reserved for the entire z-wave network being unavailable and is determined by this template sensor.
Z-Wave Network Sensor
- trigger:
- platform: homeassistant
event: start
- platform: event
event_type: event_template_reloaded
- platform: state
entity_id: sensor.time
binary_sensor:
- name: "ZWave Network"
unique_id: zwave_network
icon: mdi:z-wave
device_class: connectivity
state: >
{{ (is_state('binary_sensor.z_wave_js_running', 'on')
or is_state('binary_sensor.z_wave_js_to_mqtt_running', 'on'))
and is_state('sensor.zwave_controller_status', 'ready')
and integration_entities('zwave_js') | select('has_value') | list | count > 0 }}
The state of warning is used if there are one or more offline z-wave devices.
Offline Z-Wave devices sensor
- sensor:
- name: "Offline ZWave Devices"
unique_id: offline_zwave_devices
icon: mdi:z-wave
unit_of_measurement: devices
state: >
{% set entities = state_attr(this.entity_id, 'entity_id') %}
{{ -1 if entities == none else entities | count }}
attributes:
entity_id: >
{{ expand(integration_entities('zwave_js'))
| selectattr('entity_id', 'contains', 'node_status')
| selectattr('state', 'in', ['dead', 'unavailable', 'unknown'])
| map(attribute="object_id")
| map('regex_replace', find='(.*)_node_status', replace='button.\\1_ping', ignorecase=False)
| list | sort }}
What I would like to do is use the sensors provided for the z-wave hub to set values for the status sensor that make sense for the states of severe, warning, and minor. I have a basic understanding of what most of these sensors are, I really don’t know enough about what the values of these sensors should be to classify them properly.
Z-Wave Controller sensors
sensor.z_stick_gen5_usb_controller_messages_dropped_tx
sensor.z_stick_gen5_usb_controller_messages_dropped_rx
sensor.z_stick_gen5_usb_controller_messages_not_accepted
sensor.z_stick_gen5_usb_controller_collisions
sensor.z_stick_gen5_usb_controller_missing_acks
sensor.z_stick_gen5_usb_controller_timed_out_responses
sensor.z_stick_gen5_usb_controller_timed_out_callbacks
sensor.z_stick_gen5_usb_controller_average_background_rssi_channel_0
sensor.z_stick_gen5_usb_controller_current_background_rssi_channel_0
Is there anyone who would be willing to have a quick look and classify these sensors like this for me?
missing_acks: severe > 25, warning > 15, minor > 5