Logical Sensor Names

Please forgive me in advanced if this question has already been addressed or I have missed some functionality that has been implemented already. I have been using Home Assistant for many years, a great but frustrating product. I appreciate all the work but management of these environments is very time consuming and certainly not working as a turnkey setup for the non technical. I currently have 3 installation for family members that I look after with 100’s of lines of yaml automations. One of my biggest frustrations that I can’t seem to find the answer to is the lack of a logical sensor name to physical sensor name translation function. A few years ago there was an entity id table, but access to that has disappeared. As I understand it you cannot use friendly name( because of spaces etc.) in yaml. So I am stuck with names like ‘binary_sensor.smoke_sensor_158d00XXXXX’. I use a lot of xiaomi sensors over 20 per site. If you need to change a sensor you need to hunt through all your automation scripts and change the physical name. If you want to write a new automation and propagate it to other sites you need to change the physical sensor name for each installation. I get around this in many cases using generic automation scripts that use entries in the secrets file to create logical names. I also creating groups (eg group.door_sensors) to represent logical sensors. using these tools allows changes to be made to either of these files to be propagated down to generic automations. This has limitations, especially in group sensors. Is there a table somewhere where I can translate a logical sensor name to a physical sensor name (eg. hall_smoke_detector to binary_sensor.smoke_sensor_158d00XXXXX), so I can write generic automation scripts using logical sensor names and therefore lesson the work associated with a sensor change or setting up a new installation. I see there is some new fuctionality associated with blueprints using !input, but this looks like a total rewrite of existing automations. Thanks.

You should have renamed the entity ids to something identifiable when adding them. You can still do it now but you will have to do a find and replace for all the instances where the entity is used in automations, scripts and customize.

1 Like

Now I am confused.I have always thought that you cannot use the friendly name in automation yaml scripts. If you can is there a requirements for the format of the friendly name eg. no spaces. Or are we talking about some other name to store the logical name for an entity id. The entity register (see below) has entity_id,name,original_name, I assume friendly_name is the the name (confusing), Is there some documentation I can look up on creating a logical name for an entity ID that can be used in yaml scripts. I don’t want to start something that is going to break in future updates. eg. Do I use the customization.yaml, the gui, edit the core.entity_registry, and which exact field is the logical_name to use in the scripts, the name, the friendly_name, the original_name ??. Thanks in advance.

           "entity_id": "binary_sensor.smoke_sensor_158d0001536a94",
            "config_entry_id": "acebfd13b5791ba35b517752e873a039",
            "device_id": "5ab67c293aaf91020234580a0fc8d8ea",
            "area_id": null,
            "unique_id": "alarm158d0001536a94",
            "platform": "xiaomi_aqara",
            "name": "Smoke Detector",
            "icon": null,
            "disabled_by": null,
            "capabilities": {},
            "supported_features": 0,
            "device_class": "smoke",
            "unit_of_measurement": null,
            "original_name": "Smoke Sensor_158d0001536a94",
            "original_icon": null

Go to configuration / entities. Click on the entity, rename the entity_id to something sensible.