Expose NodeID on the Zwave devices

nice!
if I try this (taking out the area because I want them all, and taking out the entity_dict because it does not seem to do anything in the output?):

  {% set ns = namespace(device_dict=dict()) %}
  {% for entity in integration_entities('zwave_js') %}
      {% set name = entity | device_id | device_attr('name') %}
      {% set id1, id2 = entity | device_id | device_attr('identifiers') %}
      {% set node = id1[1].split('-')[1] %}
      {% set ns.device_dict = dict.from_keys([(name, node)], **ns.device_dict) %}
      {% endfor %}

  |Device||Z-Wave ID|

  |:----|--|:----|

  {% for item in ns.device_dict -%}

  |{{ item
  }}||{{ ns.device_dict[item] }}|

  {% endfor %}

I only get a handful of devices.

also, when I try the device_attr('name_by_user') the following error is displayed

TypeError: keywords must be strings

edit

see post below: the list is abridged because unique is used on the device names.

the type error was caused by the fact 2 of my devices had no name_by_user set… Ive fixed that, and now the Markdown is beautiful in a, sorted, table

No more use of Zip though :wink:

          - type: custom:hui-element
            card_type: markdown
            card_mod: !include /config/dashboard/card_mods/box_margin_0_16_16_16_markdown.yaml
            content: >
              {% set ns = namespace(device_dict=dict()) %}
              {% for entity in integration_entities('zwave_js') %}
              {% set name = entity|device_id|device_attr('name_by_user') %}
              {% set id1, id2 = entity|device_id|device_attr('identifiers') %}
              {% set node = id1[1].split('-')[1] %}
              {% set ns.device_dict = dict.from_keys([(name,node)], **ns.device_dict) %}
              {% endfor %}

              |Device||Z-Wave ID|

              |:----|--|:----|

              {% for item in ns.device_dict|sort -%}
              |{{item}}||{{ns.device_dict[item]}}|

              {% endfor %}

1 Like