DCSBL / ha-homewizard-energy

The old custom Home Assistant integration for HomeWizard Energy. This integration is now available in Core.
https://community.home-assistant.io/t/custom-component-homewizard-energy-wifi-p1-meter-and-kwh-meter/227441
Apache License 2.0
26 stars 3 forks source link

HomeWizard device is rediscoverd after installing Home Assistant 2022.2.0b0 #74

Closed pimw1 closed 2 years ago

pimw1 commented 2 years ago

My HomeWizard Energy plug is rediscoverd after installing Home Assistant 2022.2.0b0. It was working fine in the last non-beta version (2021.12.10).

Environment (please complete the following information)

To Reproduce

  1. Upgrade from your current Home Assistant version to version Home Assistant 2022.2.0b0
  2. Click on 'Notifications': the notification is mentioned here

Expected behavior

Since my HomeWizard Energy Plug is already integrated, i am expecting no notification at all about HomeWizard Energy.

Screenshots

image image It's already installed and my Energy Plug is just working fine. image

Log Output

Additional context

Add any other context about the problem here.

DCSBL commented 2 years ago

You are one of the first to see the official HomeWizard Energy integration in action.

Due to big changes, the custom and core version are incompatible. So you have to reconfigure or ignore the newly discovered.

Please let me know if you found any issues.

pimw1 commented 2 years ago

Thanks! I'll transition to the new version now and let you know the outcome. Congrats with the official integration!

pimw1 commented 2 years ago

It's working awesome! image And my dashboards are also populating nicely image

Thank you for this integration!

dieugab commented 2 years ago

Not to hijack this issue, but is it easy to migrate from the custom component to the official integration? Will the Energy Dashboard lose data if you change the entities?

pimw1 commented 2 years ago

In my case, i wrote down all entity id's, entity names and the device name before deleting the custom component. Then rebooted twice (for entity removal), added the new integration, and copy-pasted back all entity-ids, entity-names and the device name.

However, i'm using TimescaleDB + Grafana, not the Energy Dashboard of Home Assistant. So i am not sure what will happen with the aggregated data that the Energy Dashboard of Home Assistant is using.

What you could do, is first make a proper backup, make the switch, and see what will happen. In that way, you can always go back to the backup if needed.

DCSBL commented 2 years ago

@gvssr we could try that. We have to migrate the domain (from homewizard_energy to homewizard, is that possible?

For now my advice is to ignore the newly discovered devices. I will follow up if I know more.

pimw1 commented 2 years ago

Shall i close the current issue, or would you like me to keep it open for further discussion?

DCSBL commented 2 years ago

Let's leave it open until we have concluded what to do.

DCSBL commented 2 years ago

I am able to migrate the entries but it seems the that the history data is lost at that moment. Any ideas? It feels wrong to do it like this but I can't see any better way:

# __init__.py in homewizard_energy custom component
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    """Set up ."""

    await hass.config_entries.async_remove(entry.entry_id)

    entry.domain = "homewizard"
    entry.data = {
        'ip_address': entry.data['host'],
        "migrated": True
    }

    await hass.config_entries.async_add(entry)

    return False
DCSBL commented 2 years ago

As is seems to be hard or impossible to migrate the data to the new domain, I will just leave it as is.

If someone has an idea how we can migrate the history data, let me know!

DCSBL commented 2 years ago

Figured it out. If this pr is merged and released I will release an update for the custom integration so the migration is triggered. It should migrate all data and allows you to keep any automations and views.

DCSBL commented 2 years ago

Migration is approved and merged. When 2022.2.2 is released I will release a version that triggers the migration.

dieugab commented 2 years ago

@DCSBL looks like 2022.2.2 is out. Is it safe to migrate? Has the integration in HACS been updated yet?

DCSBL commented 2 years ago

Wow, give me a moment. It is out for a few hours.

DCSBL commented 2 years ago

https://github.com/DCSBL/ha-homewizard-energy/releases/tag/0.13.0

MAKE SURE TO MAKE A BACKUP

This migration is tested on my setup. But I can't be sure if it works on all situations. Please let me know if you run into problems.

dieugab commented 2 years ago

Should we update to 2022.2.2 first, and then install the beta? Or first the beta and then HA update? Just making sure before I take the plunge. 😬

DCSBL commented 2 years ago

Install 2022.2.2 and then update the custom integration.

HACS will prevent the other way around but if you installed the custom integration manually, make sure to do it in the right order.

nicokars commented 2 years ago

How i can see, which is NEW the integrated HW? is that with the Blizard sign? also i am missing daily gas use

DCSBL commented 2 years ago

The core integration is indeed the one with the HomeWizard Energy logo.

dieugab commented 2 years ago

@DCSBL migration worked perfectly. You're a legend, thank you!