Shelly4hass and native Shelly integration

The Shelly4hass custom integration and the native shelly integration use the same domain “shelly”. This is the reason why you cannot use both at the same time.
But it is possible to move Shelly4hass to a new domain.

  • shut down homeassistant

  • in the custom_components/shelly directory change const.py
    DOMAIN = ‘shelly’ → DOMAIN = ‘shelly4h’

  • in the custom_components/shelly directory change manifest.json
    “domain”: “shelly” → “domain”: “shelly4h”,
    “name”: “Shelly” → “name”: “Shelly4hass”

  • in config_flow.py:
    return self.async_create_entry(
    title=“Shelly4hass”,
    data=system_options
    )
    and
    async def async_step_final(self):
    return self.async_create_entry(
    title=“Shelly4hass”,
    data=self._options
    )

  • in .homeassistant/.storage/core.config_entries:

    “domain”: “shelly4h”,
    and
    “title”: “Shelly4hass”,

  • in .homeassistant/.storage/core.device_registry:
    “identifiers”: [[“shelly4h”,…]]

  • in .homeassistant/.storage/core.entity_registry:
    “platform”:“shelly4”

  • in configuration.yaml:
    shelly: → shelly4h: (if you have that)

You shoud not be using ShellyForHass

ShellyForHass will no longer receive further development updates. This decision stems from the fact that its features and functionality have been seamlessly integrated into Home Assistant, making it redundant to maintain a separate plugin.

https://github.com/StyraHem/ShellyForHASS?tab=readme-ov-file#discontinuation-of-shellyforhass

Just use the core integration.

It is not possible to use the core integration while you have Shelly4hass still active. This means you have to migrate somehow from Shelly4hass to Shelly native.

  1. Delete S4H
  2. Install HA core Shelly integration.

Do you think the native Shelly integration takes over the 50 old S4H entities?
And if not, how do I know what “shelly_shem_3_d8bfc01a7fae_1_current_consumption” is that is used in 4 automations and 3 template sensors?

Yes. Why wouldn’t it?

Why the heck did you not rename your Shelly’s to something easily recognisable like mains_power?

Also you can add the Shelly devices discovered by the core integration one by one and rename them as you go. You don’t have to add them all at once.

You never migrated from Shell4hass to shelly, right?

Correct I never had the need for Shell4hass. Right from when I started using Shelly devices five years ago, back then mqtt and the HA restful integration was all that was needed for full functionality but as the core Shelly integration got better I switched over to that.

Thanks! This might be really helpful for us who still struggle with migrating. Could you confirm this does not change the entity_ids of the devices at all?
My key issue is the energy data and long term statistics. I want to keep it and if I understand correctly I cannot reboot between renaming the entities but if I can do them one by one then that would be a really great trick.

With my receipe, you have both shelly integrations in parallel and the entity ids are kept.

Thing is Tom that S4H uses the same domain, shelly, which is the same as the native integration. Sure you can remove S4H and then in your own pace add them one by one back to native Shelly but as you understand you will loose the devices in the mean time. On top off that you will loose all long term stats including energy data.

Moving from S4H is not trivial at all if you require all data to be kept. This solution does not automate any of the steps no, but it heavily reduces the risk of data loss and continuous labour. If I would do all of this in one go I know I have to complete it at the same session as I start it. This method removes that obstacle as well.

Unfortunately this did not go as planned. I cannot find a way to delete devices or even entities provided by S4H. Since I cannot delete them on the fly I cannot give the new entities from the official integration the same ID.

Have you managed to successfully migrated and kept LTS and Energy data?