Add node information to child entities of the zwavejs devices

The old zwave 1.4 integration supplied the “node_id” of the zwave device in the attributes of the child entities.

Right now you have to click thru each device in the devices section to find which device/entity is associated with each node.

Before you could simply go to the states page and filter on “node_id” in the attributes to list all zwave entities with their associated nodes.

It would definitely be more user friendly if they were included in the entity attributes as well.

For the time being, just output the list in developer tools → template editor

{% set ns = namespace(devices=[]) %}
{%- for device_id in states | map(attribute='entity_id') | map('device_id') | unique | reject('eq', none) %}
{%- set identifiers = device_attr(device_id, 'identifiers') | list | selectattr('0', 'eq', 'zwave_js') | selectattr('1', 'search', '^([0-9]+)-([0-9]+)$') | list | first | default %}
{%- if identifiers %}
  {%- set node = identifiers[-1].split('-')[-1] | int %}
  {%- set ns.devices = ns.devices + [(node, device_entities(device_id))] %}
{%- endif %}
{%- endfor %}
{%- for node, entities in ns.devices | sort(attribute='0') %}
{{ node }}:
{%- for entity in entities %}
- {{ entity }}
{%- endfor %}
{% endfor %}
4 Likes