Sorry if this is a very basic question. Im still new to HASS development.
I use a custom integration for energy monitoring (it polls data from a third party site).
Because of some migration happening by the seller some users will be moved to a new platform and others wont this.
As a result, I want to fork the integration to a new one but I want users to keep their existing energy data.
I plan to keep the same entities so it would be just the integration domain that would change (e.g. sensor.integrationA_power would become sensor.integrationB_power)
What is the best way to achieve this? I dont think keeping the same integration domain makes sense since it is a new integration. Is there a way to keep the history with the new entities?
this means my integration needs to keep using the old integration domain, right? (to keep the entity prefix)
isnt reusing the domain from a diferent integration a bad practice? do I have no other choice?
No. The domain is sensor, here. Whatever comes after it, e.g. integrationA_power is called an object id, and is not linked to an integration.
Actually, the bad practice is to have the integration name in an object_id. The object_id traditionally represent the purpose of an entity, e.g. sensor.power_living_plug, but integrations are free to generate whatever object id they want.
I think I understand now. the entities provided by the old integration need to be deleted first.
so in order to migrate to a new integration, users would need to
remove the old integration
delete the existing entities
add the new integration.
Otherwise new integrations with _2 would be added. It does seem that if the energy entities are deleted and recreated with the same ids, history is preserved.