Here’s something I quickly wrote up, after seeing this requested many times. Let me know how it goes if you try it.
Copy and paste this code into the Dev Tools Template editor:
{%- 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 }}
It will output a JSON object in the format ZUI uses for node name and locations backups. Save the template output to a file named nodes.json
(or whatever you want).
In Z-Wave JS UI, go to the Control Panel, click the blue FAB (floating action button), Advanced Actions, then IMPORT under the Backup section. Pick the file created above.
In the future, to keep both applications in-sync always add nodes from ZUI, as it allows you to pre-configure names and locations before including a node. During inclusion, HA will see the pre-configured values.