Export Names/Descriptions from HA to import into ZwaveJS #4294
-
Checklist
Describe the issueWhat is happening? What did you expect to happen instead? Steps to reproduce the behavior:
Anything else we should know? Software versionsDriver (zwave-js): ...15.9.0 Z-Wave JS UI: ...10.9.0.26f2e69 HA running zwave js in it's own docker Z-Wave Controller (Stick/Dongle/...)discussions Device informationManufacturer: ... Checklist
Upload LogfileNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I think it would be helpful to debug this if you shared the file that gives an error. |
Beta Was this translation helpful? Give feedback.
-
It's simply impossible that your template script ever worked. Your script a) produces a YAML document while ZUI requires JSON, and b) it's in the wrong format, containing lists of HA entity IDs for each node and not names and locations of each node. Perhaps you were using different code before when it was working. Here is template code to export names and locations from HA into JSON for import by ZUI (from https://community.home-assistant.io/t/switching-z-wave-js-addons-with-minimal-downtime-z-wave-js-official-to-z-wave-js-ui-community/409904#step-11-optionally-export-device-names-and-locations-10): {%- set ns = namespace(nodes=[], export={}) %}
{%- for dev_id in integration_entities('zwave_js') | map('device_id') | unique %}
{%- set node_id = (device_attr(dev_id, 'identifiers') | first | last).split('-')[1] %}
{%- set ns.nodes = ns.nodes + [(node_id | int, dev_id)] %}
{%- endfor %}
{%- for node_id, dev_id in ns.nodes | sort(attribute='0') %}
{%- set node = {(node_id | string): {}} %}
{%- set name = device_attr(dev_id, 'name_by_user') %}
{%- set location = area_name(dev_id) %}
{%- if name and location %}
{%- set node = {(node_id | string): {"name": name, "loc": location}} %}
{%- elif name %}
{%- set node = {(node_id | string): {"name": name}} %}
{%- elif location %}
{%- set node = {(node_id | string): {"loc": location}} %}
{%- endif %}
{%- set ns.export = dict(ns.export.items(), **node) %}
{%- endfor %}
{{ ns.export | to_json }} |
Beta Was this translation helpful? Give feedback.
It's simply impossible that your template script ever worked. Your script a) produces a YAML document while ZUI requires JSON, and b) it's in the wrong format, containing lists of HA entity IDs for each node and not names and locations of each node. Perhaps you were using different code before when it was working.
Here is template code to export names and locations from HA into JSON for import by ZUI (from https://community.home-assistant.io/t/switching-z-wave-js-addons-with-minimal-downtime-z-wave-js-official-to-z-wave-js-ui-community/409904#step-11-optionally-export-device-names-and-locations-10):