Human-readable node ID in new Z-Wave JS?

I’m in the slow process of trying to get Z-Wave working on the new ZwaveJS to MQTT and ZwaveJS integration.

With the old Z-Wave when a scene was triggered or a notification was sent to my Inovelli switches, I could reference the entity ID with a human-readable name like “zwave.matt_bedroom_fan_light” or using a template like “{{ state_attr(‘zwave.matt_bedroom_fan_light’,‘node_id’) | int(‘Invalid’) }}” so that I didn’t have to figure out all the places it was referenced everywhere if the zwave device ID changed.

An example of why it would change is like if you unpair/repair it moving to a different zwave stick for a firmware-update when you pair it back the ID would change, but as long as the name was given the same for the entity everything “just worked”.

I’m having a hard time finding an equivalent way to look up zwave entity/node ID values by a human readable label.

If you go to the zwavejs integration under the configuration menu and click on “xx devices” it will bring up a list of every device and if you then click on the device it will give you info about the device including the node ID and all of the entities associated with that device.

if you click on the entities you will be able to change the entity_id and friendly name of each entity there to the same as the old entities.

However to make it easier you can rename the device itself in the top left corner of the device display. And then when you save the updated name it will ask you if you want to rename the child entities as well and it will transfer the base name of the device to all those entities too. you can use that as a starting point for renaming entities.

Right, but then something like a scene everything I see requires the zwave numerical ID.

For example:

  - alias: 'Matt Bedroom Light Med'
    trigger:
      - event_type: zwave_js_value_notification
        platform: event
        event_data:
          property: "scene"
          node_id: 22
          property_key: "002"
          value: "KeyHeldDown"
    action:
      service: light.turn_on
      data:
        entity_id: light.matt_bedroom_light_dimmer_level
        brightness_pct: 50

Right now, that switch is node_id: 22 but if I have to for some reason unpair/repair it from the zwave network, it will be some other value, and I’ll have to hunt down everything that references 22 and change it to the new value.

The old way I could just reference entity_id: zwave.matt_bedroom_fan_light and it didn’t matter what the numerical zwave ID was, it always mapped to the device that I named “Matt Bedroom Fan Light”.

I’m not seeing a way for this to translate.

Not necessarily…

Tho some devices may have switched from having entity_ids for some functions most of the devices that need to use event info now also needed to to use event info in the old zwave too.

all of my scene switches and buttons work the same now as they did before - I still needed the node/event info then the same as I do now.

and it then followed that if I replaced a device in the old integration I would still need to do the same conversion to the new node info as I do now with the new integration.

maybe you were just one of the unlucky few that zwavejs removed a (non-standard) entity and converted to using (standard) event data. :man_shrugging:

But you were asking for a human readable “node id in zwavejs” and the answer to that is that there already is that info available.

the good news tho is that once you get the zwavejs event data conversion completed if you then need to replace a device as long as you use the same model device then everything should work if you just change the node id only. all of the other event data should be the same since it’s the same model of device as the old one.

No, I was asking for a human-readable way to reference it in automatons and such, not just a way to see it myself.

Sure you can just change the number but its remembering all the places that depend on that - that’s the hard part.

This seems like a step backwards. Before you could do it 2 ways easily.

And before even if it required a numeric value, you could still do that with a human-readable label:
"{{ state_attr('zwave.matt_bedroom_fan_light','node_id') | int(0) }}"

I did this for my notification configuration values just like I used the zwave.matt_bedroom_fan_light for my events triggers.

What I am looking for is the equivalent entity reference to these old values. But it seems like there is no longer anything equivalent to zwave.matt_bedroom_fan_light that lets me get metadata about the Zwave device in an automation/template/script/etc.

As a software engineer hard-coding values seems like a disaster for maintainability.

There is no attribute data that shows the node id for zwavejs out of the box as there were for the old entity_ids (zwave.xx etc).

it has been asked for already (by me) but I doubt it is going to be implemented if it hasn’t already.

however if you still need that info you can add it yourself by creating customizations for your entities.

it’s a lot of work but it might be worth it if you tend to change devices requiring the node ids to be updated very often.

The events provide a device ID. You can either examine all of the entities for a device, or use one of the device attributes.

For example:

{% set device_id = "b787973af6ad37eed2450e95560d0748" %}
Device name (original): {{ device_attr(device_id, "name") }}
Device name (mine): {{ device_attr(device_id, "name_by_user") }}
Device entities: {{ device_entities(device_id) }}
Node ID: {{ (device_attr(device_id, "identifiers") | list | first)[1].split('-')[1] }}

renders as:

Device name (original): In-Wall Smart Fan Control
Device name (mine): Office Ceiling Fan Switch
Device entities: ['fan.office_ceiling_fan', 'sensor.office_ceiling_fan_switch_node_status', 'button.in_wall_smart_fan_control_ping_2']
Node ID: 24

It doesn’t make any sense to associate a single entity for an event. You can access any of the entities you want as shown above. The closest thing to the zwave entity is the sensor.foo_node_status entity.

1 Like