Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform mqtt does not generate unique IDs. ID zwavejs2mqtt #819

Closed
Wojcioo opened this issue Mar 4, 2021 · 14 comments · Fixed by #851
Closed

Platform mqtt does not generate unique IDs. ID zwavejs2mqtt #819

Wojcioo opened this issue Mar 4, 2021 · 14 comments · Fixed by #851

Comments

@Wojcioo
Copy link

Wojcioo commented Mar 4, 2021

I've uploaded new version, and this node is correct discovered both in zwavejs2mqtt and in Home Assistant, but in HA in logs there is an error

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:489
Integration: Sensor (documentation, issues)
First occurred: 12:49:31 (3 occurrences)
Last logged: 16:22:09

Platform mqtt does not generate unique IDs. ID zwavejs2mqtt_0xe6dcf749_2-128-0-level already exists - ignoring sensor.sypialnia_danfoss_sypialnia_battery_level

I can't also find battery level in mqtt integration / devices.

image

I've checked all entities and I can't find more then one NodeID: 2. Where should I look for the error?

Originally posted by @Wojcioo in #607 (comment)

@Wojcioo
Copy link
Author

Wojcioo commented Mar 4, 2021

But I've got three LC13 for two I can see battery level and for one not?

image

I've attached node with the issue.
node_2.txt

@robertsLando
Copy link
Member

@billiaz ?

@varet80
Copy link
Collaborator

varet80 commented Mar 5, 2021

I am going to see that.
I faced it before, it was 99% issue of discovery on HASS side. I had to:

  1. Delete all topic on Mqtt server,
  2. cleanup hass mqtt topics from entities and put it back online!
    I then move to retained HASS discovery and stopped having this.

you could probably @Wojcioo do cleanup this node from your hass (by removeing the discovery only for this node and then cleanup failed entities) but first need to check the file you posted.

Will reply in a few hours

@varet80
Copy link
Collaborator

varet80 commented Mar 5, 2021

@Wojcioo checked the file, i find no duplicate on this discovery! I seriously believe it is stuck on hass side

can you also aupload another LC-13 node? like the one with 53% battery.
I want to compare payloads

@Wojcioo
Copy link
Author

Wojcioo commented Mar 5, 2021

can you also aupload another LC-13 node? like the one with 53% battery

@billiaz
node_3.txt

@varet80
Copy link
Collaborator

varet80 commented Mar 5, 2021

@Wojcioo looking this file too, it clearly is a hass mixup with cached discoveries

node 2 unique_ids:

        "unique_id": "zwavejs2mqtt_0xe6dcf749_Node2_climate"
        "unique_id": "zwavejs2mqtt_0xe6dcf749_2-128-0-level"
        "unique_id": "zwavejs2mqtt_0xe6dcf749_2-128-0-isLow"

node 3 unique_ids:

        "unique_id": "zwavejs2mqtt_0xe6dcf749_Node3_thermostat"
        "unique_id": "zwavejs2mqtt_0xe6dcf749_3-128-0-level"
        "unique_id": "zwavejs2mqtt_0xe6dcf749_3-128-0-isLow"

@Wojcioo
Copy link
Author

Wojcioo commented Mar 5, 2021

so I've to disable the discovery for this node in Zwavejs2mqtt, then cleanup failed entities in HASS, and restart discovery in Zwavejs2mqtt?

@varet80
Copy link
Collaborator

varet80 commented Mar 5, 2021

I do it differently.
I delete the topics from mqtt homeassistant/*
only for node 2!
then i clean the mqtt entities once they become with a RED symbol (meaning unavailable)

and send online to homeassistant/status

@Wojcioo
Copy link
Author

Wojcioo commented Mar 5, 2021

I delete the topics from mqtt homeassistant/*
only for node 2!

sorry for stupid questions - I should remove in Zwavejs2mqtt for this node from json lines with "state_topic" and "discoveryTopic" for both sensors that are not correct discovered in HA.
Than I should wait until they will be unavailable in HA, to remove this entities, and again I should restore json with this two lines.

I'm still new in this topics....

@varet80
Copy link
Collaborator

varet80 commented Mar 5, 2021

@Wojcioo No!
you do not need to touch zj2m!

you need to access HASS configuration - >entities
you need to access the MQTT

clean mqtt, clean hass, if the nodes are red (on side) then run the topic i told you (this will fake the HASS been restarted) you can ofcourse restart HASS

Alternative:
Stop MQTT access for HASS, clean entities failed and reconnect it! but up to you how you want it.

Both are Hacky but to the point!

@towerhand
Copy link
Contributor

I have this happen when adding new devices.

For settings in zjs2m I'm using MQTT discovery with the retain discovery on, what happens is that the devices get auto discovered right away after adding the node (example "homeassistant/switch/node 22"), then when you rename the node in zjs2m a new discovery topic gets published (example "homeassistant/switch/kitchen light), if you rename it again then another get published, and so on.

I usually just clear the old topics with MQTT Explorer and restart HA, but a real solution would be for zjs2m to clear the old topic when sending one if the retain discovery option is on.

@varet80
Copy link
Collaborator

varet80 commented Mar 8, 2021

@robertsLando maybe worth adding devices with disabled discovery. or have the option to add them with disabled discovery (when included) and users to enable it afterwards?
I have similar issues but I am faster than device can interview! to rename etc.

@cbho
Copy link

cbho commented Mar 8, 2021

That would definitely be nice... (@billiaz' suggestion, I mean)

To avoid trouble, I'm stopping Home Assistant when adding devices and only restarting after renaming them etc. in zwavejs2mqtt (and cleaning up MQTT (that is, before I just went for using the js server-function)).

@robertsLando
Copy link
Member

We could a dd an option like Manual Discovery, with that no discovery payload will be sent automatically but you will have to discover them manually

robertsLando added a commit that referenced this issue Mar 9, 2021
With this setting discovery payload will not be sent on startup but users will be able to send them manually from the UI. Useful when using mqtt discovery paired with zwavejs integration to discovery only some entities. Fixes #819
robertsLando added a commit that referenced this issue Mar 9, 2021
* feat(hass): added `manual discovery` setting

With this setting discovery payload will not be sent on startup but users will be able to send them manually from the UI. Useful when using mqtt discovery paired with zwavejs integration to discovery only some entities. Fixes #819

* docs: manual discovery

* fix: undefined error and added tooltips on ui

* fix: lint issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants