sensor.bad_gulv_kwh:
unit_of_measurement: kWh
friendly_name: Forbruk Bad Gulv
device_class: energy
state_class: total_increasing
the customizing doesn’t work because the entity id for some reason is sensor.forbruk_bad_gulv (that is the friendly name from the customize.yaml shown over, I have no clue where it got it, because it points to the “wrong” entity id)
“entity_id” is not allowed on template sensors, so i can’t set that.
So why is the entity id the friendly name specified in the customize.yaml, and how can i change it?
The entity id of templates sensor is the name slug, in your case the sensor you will create will be named : sensor.bad_gulv_forbruk that’s it. If you want to name it sensor.bad_gulv_kwh you will need to set it up as follow :
After changing the name i get this, the name is changed, but not the ID. And won’t changing the ID in the interface screw up my yaml-file? It has done that before, comments being removed, formatting changed, and so on?
Yes, it has a unique ID. At the moment it looks like this (i had the unique_id set from the start, but i tried changing it to entity id later, as in the first post, to fix the wrong entity_id):
OK tested it and it’s quite difficult to understand lol
I created a template sensor with name: test_id and also a unique_id
Then added a unit of measurement in customize.yaml then edited the id with the UI, the entity_id changed but it did not touched my yaml file for template declaration. And top of this the customization is gone. Because entity_id changed
So i had to change the entity_id in customize.yaml and that’s it.
So you can change the entity_id in UI, change also the display name from UI. Just think to adapt the customization to the new entity_id.