openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

[mqtt.homie] Update thing if it changes #7467

Closed piegamesde closed 2 years ago

piegamesde commented 4 years ago

I am currently developing an application using the homie convention. This involves a lot of testing and prototyping. Sadly, when I add new nodes or properties to my device, this isn't reflected in the UI by showing new channels in that thing. To be able to see the added properties, I'll have to remove the thing and auto-discover it again. This is a nuisance because now it'll have a different ID so I need to update the Item ID of all existing items in my sitemap.

Please add some kind of way to update an existing thing if its homie representation changed. This may be as simple as a manual button to re-trigger discovery or an OpenHAB restart.

Your Environment

bodiroga commented 4 years ago

Hi @piegamesde!

I've made some tests and you are partially right. In my case, the binding is able to detect newly added and removed nodes, but not properties. Can your confirm what I see?

piegamesde commented 4 years ago

I did a few tests regarding adding and removing nodes:

Removing a node

Works

Adding that node back in

Partially works. The properties are detected, but some are detected with data type dummy. They cannot be edited nor linked (the link button simply does nothing).

Adding a new node

Does not work. Even multiple restarts did not make the properties of the new node appear in the list.


I'm on OpenHAB 2.5.6-1.

depau commented 3 years ago

I can confirm this behavior.

The 4.0.0 specification says devices can set their $state to init and change anything in the hierarchy: https://homieiot.github.io/specification/#device-reconfiguration

Therefore the MQTT binding should expect new channels to show up / disappear / change while in init state.

hmerk commented 2 years ago

I am closing this, as changes to thing structure (adding or removing channels) need to delete and readd the things. This is per actual design in openHAB-core.