Identifying devices from ID

How do people identify devices from the ID presented in the log? I have started to add the ID to the device name, but there has to be a better way? I would like to list them in device ID order…


Can you show an example?

Ive never had an issue seeing anything but wonder if that because I always reference my automations by entity not device (makes replacement of a device an order of magnitude easier)

Excerpt from the log:

2023-11-20T19:30:04.992Z CNTRLR « [Node 039] received wakeup notification
2023-11-20T19:30:04.993Z CNTRLR   [Node 039] The node is now awake.
2023-11-20T19:30:04.994Z CNTRLR   [Node 039] expects some queries after wake up, so it shall receive
2023-11-20T19:30:04.995Z CNTRLR   [Node 039] compat query "Battery"::get()
2023-11-20T19:30:05.004Z CNTRLR   The controller response indicated failure after 1/3 attempts. Scheduling next 
                                  try in 100 ms.

Now, which node is that? The device list does not have a node ID column, which would have helped. To compensate for that, I have included the ID in the device name, but that has downsides, like the replacement issue:

Is there a better way?


I created a table like this using the flex table card

The key to using this card is to bring all the columns together into one entity

  - sensor:
      - name: zw_comms_garage_thermostat
        state: "{{states('sensor.garage_thermostat_node_status')}}"
          d_rx: "{{ states('sensor.garage_thermostat_commands_dropped_rx')  }}"
          d_tx: "{{ states('sensor.garage_thermostat_commands_dropped_tx')  }}"
          rtt: "{{ states('sensor.garage_thermostat_round_trip_time')  }}"
          rx: "{{ states('sensor.garage_thermostat_successful_commands_rx')  }}"
          tx: "{{ states('sensor.garage_thermostat_successful_commands_tx')  }}"
          to: "{{ states('sensor.garage_thermostat_timed_out_responses')  }}"
          lat: "{{ states('sensor.zw_garage_thermostat_latency')  }}"
          online: "{{ states('binary_sensor.zw_garage_thermostat_online')  }}"
          last: "{{ states('sensor.zw_garage_thermostat_last_updated')  }}"
          nm: "garage_thermostat"
          node_id: 22
          rssi: "{{ states('sensor.garage_thermostat_rssi')  }}"

I also have another view that uses the other info.


The term you’re looking for is Node not ID. To get the node of zwave device programmatically, you can use a template to extract it from the device attributes. Here is an example, paste this into the template editor in developer tools:

{%- set ns = namespace(kvps=[]) %}
{%- set zwave_devices = integration_entities('zwave_js') | map('device_id') | unique | list %}
{%- for zwave_device in zwave_devices -%}
  {% set name = device_attr(zwave_device, 'name') -%} 
  {% set node = (device_attr(zwave_device, 'identifiers') | first | last).split('-')[1] -%}
  {% set ns.kvps = ns.kvps + [(node, name)] -%}
{% endfor -%}
{% set zwave_nodes = dict.from_keys(ns.kvps) %}

{{ zwave_nodes }}
Or a specific node:
{{ zwave_nodes['5'] }}
1 Like

Wow, that seems like a lot of work, but I like the result! :ok_hand:


Very interesting with a programmatic solution, since it probably handles the fact that nodes sometimes have to be re-added (because they misbehave…)!


Thank you both for two very interesting solutions to this problem! I will look into both and see what I manage to do.


It could be. I created it once and then use shell scripts to gen the HA config. It also does alerting if devices go offline, automatic pinging, creates the dashboard, etc.

So to add a new device I make an entry in a csv file and it generates all the config.

I have 2 houses so to keep stuff consistent I autogen 90% of the config + dashboards.

1 Like

I manage to come up with this dict:

Two questions:

  1. Can it be expanded with more fields or do I have to create more dicts for each extra field?

  2. How do I use it to create a template sensor?


You can do pretty much whatever you want with templates. You just need to figure out the structure you want to end up with. Any combination of dictionaries, lists, and strings is possible.

Here’s another example that will list out the entities associated with each node.

Whatever template you end up with, you can feed it into the attributes of a template sensor configured in yaml.