-
Notifications
You must be signed in to change notification settings - Fork 2
Migrating between integrations
When you change integrations, you want to retain your sensor history and hook ups to things like the energy dashboard.
For this to work, before migrating, remove all the settings for the old integration from your configuration.yaml and restart HA. You can remove any old files that are no longer used if you wish. Do NOT remove old sensors in Settings, Devices & Services, Entities.
Install the new integration and restart HA.
Now go to Settings, Devices & Servies, Entities and review the sensors that are available:
- Look for sensors that are no longer available. These have a red circle under status. You can select these sensors by ticking the box at the start of the line. Click Remove Selected and HA will remove any sensors in the list that are no longer provided by an integration
- Enter _2 in search and look for sensors that have _2 appended to the end. These are new sensors that replace old ones, but HA did not join them up correctly. Click on the sensor, click on the gear, edit the Entity ID, removing _2 from the end and click update. Do this until you have fixed all the sensors with _2 appended
- Restart HA and go to Settings, Devices & Settings, Entities and check the status again for broken sensors. Click on your favourite sensor and check the history is displayed correctly.
Each entity has 3 different names / IDs:
- Name: the 'display name' used when adding sensors to dashboards. This is the default name displayed for an entity
- Entity ID: the name used when referring to an entity in a script, such as a template
- Unique ID: an underlying name, used to keep track of entities when changes are made to the friendly name or entity ID
By default, when a sensor is created, you specify the name and unique ID. HA creates the entity ID from this - typically, changing the name to lower case and replacing spaces with undescrore. For example, Battery Voltage has an entity ID 'sensor.battery_voltage'. If this name already exists under a different unique ID, HA appends _2, _3 etc until it finds a unique entity ID.
During migration, if a unique ID already exists and has an associated Entity ID, Home Assistant will update the display name but retain the previous entity ID. This can lead to problems when that sensor is referenced in scripts.
You can update the entity_id used by Home Assistant where a unique_id is used:
- Go to Devices & Services, Entities
- Find the entity that has an incorrect Entity ID and click on it. A history dialgoue box opens.
- Click on the gear in the dialogue box. The settings for the entity appear.
- Edit the Entity ID and click Update to save the changes.
Changing the Entity ID will disconnect the database history for the old Entity ID and start adding history for the new Entity ID. If the new Entity ID previously existed, the new Entity ID will inherit the previous history.