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
518 stars 120 forks source link

Add setConfig to call publishConfig for dynamically created device types #263

Open zappityzap opened 3 months ago

zappityzap commented 3 months ago

Add a public wrapper called setConfig() to allow calling the protected publishConfig() during loop(). This appears to be necessary in order to set the icon, name, etc. on a dynamically created HASensor in the main loop.

My use case is a base station and multiple sensor nodes. The base station dynamically creates a new HASensor each time it receives a message from a sensor node with an ID it hasn't seen before.