Hello,
I am trying to set a unique_id for my template sensor, but it is ignored by HA. I expect the entity ID to be ble_battery_fa748e71106b, but it is sensor.ble_battery_monstera_deliciosa instead.
I tried removing the name: "ble battery Monstera Deliciosa" part, but even then the ID is sensor.template_ble_battery_fa748e71106b
Can anyone tell me what am I doing wrong? Thanks!
Unique ID is not entity_id. (yes I know. There’s many threads on the site about why we need another unique ID in top of what was once supposed to be a unique ID - just go with it)
The entity ID for template sensors currently appear to be based on the name. (slugified if you have spaces. “My super Device” becomes [device domain]. my_super_device) so set the name: field to be what you want and the entity ID will auto-generate based on that.
Adding unique_id will then allow you to further customize the template sensor in the UI (which I believe includes further editing the entity ID of you wish)
I don’t remember being able to specify the entity ID in the template but would be happy to be wrong… That probably would require a feature request
That makes sense, thank you very much for the detailed explanation. I just edited the entity ID in the UI to match the unique_id I wanted - not ideal, but it works.