New Entity IDs on zwavejs2mqtt reboot


I’m just checking if I configured something wrong or it’s a bug somewhere.

I use zwavejs2mqtt, 1.0.0-rc.1 version - in docker, which runs on a remote R-Pi and sends MQTT Messages to my main HA instance.

Everything was configured correctly, then overnight I lost power and my zwavejs2mqtt lost power and restarted.

What happened is that some of the devices became unavailable and new ones were created with “_2”, for example:

sensor.nodeid_19_notification_home_security_motion_sensor_status - became unavailable
sensor.nodeid_19_notification_home_security_motion_sensor_status_2 - was created

I had MQTT Explorer running on a computer that didn’t loose power - I have UPS on it, and I can see a new discovery message was sent, but it’s identical to the previous ones, same topic was used, the MQTT Message is:

  "value_template": "{{ {0: \"idle\",8: \"Motion detection\"}[value_json.value] | default(value_json.value) }}",
  "icon": "mdi:motion-sensor",
  "state_topic": "zwave/nodeID_19/113/0/Home_Security/Motion_sensor_status",
  "json_attributes_topic": "zwave/nodeID_19/113/0/Home_Security/Motion_sensor_status",
  "device": {
    "identifiers": [
    "manufacturer": "AEON Labs",
    "model": "Multisensor 6 (ZW100)",
    "name": "nodeID_19",
    "sw_version": "1.14"
  "name": "nodeID_19_notification_home_security_motion_sensor_status",
  "unique_id": "zwavejs2mqtt_0xf4c9e959_19-113-0-Home_Security-Motion_sensor_status"

I then later restarted the docker container, this issue was not seen again.

Did anybody else see this?

Thank you.

Have you enabled persistent discovery? That should fix it

I have not, I just did it and restarted zwavejs2mqtt.

I suspect you are referring to the “Store” flag in the mqtt settings, right? Of the “Store” at the node level? The “Retain” flag was already set since I configured the first time the instance.

I meant Retained Discovery on the Gateway settings, sorry for the confusion on my end, my mind sometimes leaves me hanging :wink: That is what should prevent creating duplicate entities

Enabled it, I see the discovery messages now marked as retained.

I’ll keep an eye on the things.