Hello all,
I’m having fun using my ESP8266 board registering to Home-Assistant via MQTT. I’m trying to present the board to let HASS discover the new device. Until here all ok.
The presentation (subscribe to MQTT) is as follow, for one switch:
XefilHome/switch/Studio_Switch01/config {"name":"Studio Switch01","command_topic":"XefilHome/switch/Studio_Switch01/set"}
XefilHome/switch/Studio_Switch01/state OFF
Now, the above ‘config’ is presenting the switch which is then recognized as switch.studio_switch01 with friendly_name: "Studio Switch01".
If I would like to add a second switch with a different name, I’ve noticed that the name field in the config JSON is used to create the friendly name as well as the device name. I.e.:
It creates switch.not_used with friendly_name: "Not Used".
I would expect something like switch.studio_switch02 with friendly_name: "Not Used".
Is this behaviour expected or I’m doing something wrong?
I would like to have the switch name related to the <object_id> and the friendly_name related to the name.
If you’re using discovery just add the integration and get rid of all the MQTT config from config… HA will use the defined name in the device. Then in the device just make sure discovery is enabled and it has a unique name.
Hello,
Thanks for the answer but that’s not exactly what I was looking for.
I know I could correct the friendly_name using customizations, but was wondering if, during the presentation, I can submit both a name AND a friendly_name, different each other, so that HASS can then use both informations automatically
Thanks, Simon
Running into the same issue.
Setting the ‘name’ to the wanted friendly_name seems to work.
Then ‘unique_id’ can be used to determine the entity_id (I think).
I’m working on adding auto-discovery to a Netatmo-Mqtt-bridge and this config seems to create the entity like the Netatmo integration also creates it: