Hi!
Im trying to sett unique_id: with a custom MQTT sensor, but it dosent work. It takes the name as ID
- unique_id: "heatingSystem_heatcarrier_out_temperature"
name: "Värmebärare Ut (GT8)"
state_topic: "heatpump/0004"
unit_of_measurement: "°C"
icon: mdi:thermometer
I expected to get an entity with the name
sensor.heatingsystem_heatcarrier_out_temperature
but get
sensor.varmebarare_ut_gt8
Any advise?
Troon
(Troon)
April 25, 2023, 9:22am
2
Unique ID is not the same as entity ID. The entity ID comes from the name
. This is the same throughout the system.
I use UUIDs for my unique_id
s using this tool: https://www.uuidgenerator.net/ — for example:
- name: "Immersion switch switch input"
unique_id: 4d973a01-6229-4e16-b276-17e191f0c522
state_topic: "shellies/shelly1pm-XXXXXX/input/0"
You can rename the entity ID via the UI if you really want to:
1 Like
Thank you for pointing me in the right direction. This entity does not have a unique ID? - Home Assistant
so in my case this would be more correct…
- name: "heatingsystem heatcarrier out temperature"
unique_id: d9cc470f-bd5e-4142-a278-69001b0c8e30
state_topic: "heatpump/0004"
unit_of_measurement: "°C"
icon: mdi:thermometer
And then change the name through the UI to “Värmebärare Ut (GT8)”
Troon
(Troon)
April 25, 2023, 10:49am
4
An entity ID can only be lowercase letters without accents plus underscores.
You can keep the name
as you want it displayed by default, and alter the entity ID if you don’t like the default conversion.
What are you trying to achieve here? Where are you trying to read the name?
Okey, Im new to HA, used OpenHAB before. I’m want to end up with a sensor that has one name that is for the UI, and one entity ID for automations etc… I don’t want these to be the same, they follow different patterns (naming conventions) that I have.
Troon
(Troon)
April 25, 2023, 11:00am
6
In most cases, you can customise what is shown in the UI, no matter what the entity name is.
This is what I’m looking for. But as I understand it cant be achieved completely from YAML with MQTT.
petro
(Petro)
April 25, 2023, 12:15pm
8
It can.
- name: Some Name
unique_id: d9cc470f-bd5e-4142-a278-69001b0c8e30
object_id: heatingsystem_heatcarrier_out_temperature
state_topic: "heatpump/0004"
unit_of_measurement: "°C"
icon: mdi:thermometer
2 Likes
THANKS! This was exactly what I was looking for.