Export ZWave-JS Node numbers and descriptions

I had to update some firmware of devices recently, so I switched my zwave stick to a windows laptop with Z-Wave PC Based Controller on it. Then I was looking at a list of node numbers, with very little context as to which node was which. I figured it all out, but it would have made sense for me to note this from Home Assistant before shutting it down and moving the stick. When I look at the Z-Wave JS Devices page in HA, I see descriptions, but I can’t easily see the node number without clicking into each one.

Is there an easy way to get this listing?

1 Like

as far as I know there is no easily accessible node info in zwavejs.

in the old zwave integration it was very easy since the every zwave entity contained all of that info.

it would definitely be a nice addition to the zwavejs integration or at the least a custom integration to list it like the zha integration has.

zwavejs2mqtt lists the node numbers by default in the control panel.

The device details in HA also list the node number.

Yeah, I’m aware that it displays there, but I want to get to it the other way, or display a full listing. For example, look at the zwave add-on log and it refers to the node number. But how do you know what device that is without clicking into several? I think it would be helpful if the node number showed up on the main zwave-js integration page.

That is just a standard Home Assistant Devices listing filtered for the Integration. Mot other devices fo not have a similar property to be listed in the limited real estate of the web page.

Right, but the OP wanted something that was accessible using a template or some other mechanism without needing to click thru each device.

In the old zwave integration you used to be able to call up the node id’s by just iterating thru the “zwave.xxx” entities and using the “node_id” attribute.

using this template (stolen from Petro in a thread I can’t find…):

{%- for node, zstates in states | selectattr('attributes.node_id', 'in', range(1000)) | groupby('attributes.node_id') %}
{{ node }}:
  {%- for s in zstates %}
  - {{ s.name }}
    {{ s.entity_id }}
  {% endfor %}
{%- endfor %}

Now with zwavejs that information is no longer accessible to the user without clicking on each one or digging into the device configs in the .storage files since there is no equivalent" “zwave.xxx” entity and the child entities no longer have the “node_id” attributes like they used to.

“node_id” is nowhere to be found in the states page.

Perhaps a feature request is needed then.

I thought there was one already but looking thru the FR’s I see some that are related but none specifically for this.

I’ll post one and see where it goes.

But in searching thru looking for one I did find that the info is available thru a template but I don’t really like the output format.

I’ll play around with it for a bit to see if i can clean it up and make it more informative.

Here is the template so far from the other post:

I see you can get a lot of info through the REST API. Perhaps it can be parsed from there with a Python script.

A quick look seems to just get entities though, not devices :frowning:

Done

1 Like

This template works.

Go to Developers Tools, Template and paste:
{% 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 %}

Alan-Guggenheim, Sorry to revive this old comment, but this template is giving an error: TemplateSyntaxError: unexpected char '‘' at 81 and I could use some help.

UPDATE: I figured it out. The copy and paste didn’t work for me. Here’s the code that works for me and pasted into a code block. Thank you for providing the initial template information!

{% 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 %}
1 Like

Not sure when it was added, but there’s a JSON export under [Advanced actions] in Z-Wave JS UI. It’s a massive file which includes every last detail. You’ll either need to post-process or use a JSON reader which displays in collapsible tree format. I installed a JSON extension for VS Code. It got hung up on some \n characters which I eliminated with search/replace.

1 Like