dawidchyrzynski / arduino-home-assistant

ArduinoHA allows to integrate an Arduino/ESP based device with Home Assistant using MQTT.
https://dawidchyrzynski.github.io/arduino-home-assistant/
GNU Affero General Public License v3.0
508 stars 119 forks source link

Set device obj_id to unique_id #134

Closed Bettapro closed 9 months ago

Bettapro commented 1 year ago

This pull request adds obj_id on each component/entity configuration. This value is used by home assistant as entity_id (instead of generating one from the name).

Problem solved by this pull request:
We create one sensor with a given name ("Room1 light"), doing so, Home assistant creates an entity, its entity_id is generated from the name ("light.room1_light"). After a while we decide to improve our sketch and we'd like to change its name to keep it consistent ("Room1 light1"), Home assistant will create a new entity with the id ("light.room1_light1").

Specifying the obj_id, will solve this problem.

dawidchyrzynski commented 9 months ago

Hi @Bettapro, thank you for pointing out this feature. The object ID should not be identical to the unique ID. Additionally, it needs to be an optional parameter that users can set manually. Would you be willing to implement these fixes?

dawidchyrzynski commented 9 months ago

223