Switching from Enphase Envoy (DEV) back to core

Hi, I’ve been using the Enphase Envoy (DEV) custom component from HACS for quite some time. I am delighted to see this integration is back in core in 2023.9.0. How do I disable the custom integration, and am I at any risk of losing sensors or long-term statistics if I do so? The energy dashboard is my most important HA use case.

Here’s what worked for me

Delete the custom Enphase Envoy DEV integration
Delete the Enphase_envoy directory under config/custom_components
Restart HA
Add in the Enphase Envoy integration and it should revert to the core version

I confirm that it worked (once I deleted the directory in cuctom_components, I renamed but that doesn’t work) , only difference with the core integration is that I don’t have the sensors battery_charged / battery discharged anymore to feed the energy dashboard
( * sensor.envoy_122205017648_battery_energy_charged

  • sensor.envoy_122205017648_battery_energy_discharged )

True. Those are missing. I wonder why?

I think these are not part of the new integration. As the new integration has power sensors for all batteries (and are updated more often than the charged / discharged old sensors) i’m testing out using helpers to recreate the sensors using riesman calculation so my guess is these will be a lot more accurate than the old sensors.
Will update this topic when having a working setup

1 Like

I see some battery power values are negative and postive. Does this mean the battery is charged when the value is negative?

I’m still trying to figure how how to get the import and export value’s to show correctly in the energy dashboard.

I grabbed the custom sensors from the other thread but something seems off with the new integration. Wish this could all come as part of the Enphase integration and not have to do these custom sensors.

In theory this isn’t something the integration should expose if the api doesn’t provide it, which is the case. The integration updates the battery power: negative value is charging, positive discharging. So it should be fairly simple to get the required values. Keep you posted

Thanks for your explanation. Appreciated. Looking forward to see your riesman config.

A little difficult to debug as right now, in this period of the year, my consumption due the day is equal to the produced energy. so small differences. However when i look to the enphase readings:

And compare them with my current (old custom) integration:

afbeelding

You can see the charged / discharged values coming from the custom envoy integration are way off.

Using the new integration gives (i cannot show same picture due not having grid sensors on dev system:

Discharge is more in line with the original envoy readings, charge is somewhat behind. But i have removed / added the integration early this morning maybe that had some influence. So in my case the manually setup sensors give me more actual readings than the provided ones using custom integration.

Tomorrow i will switch from custom to new integration on my production system and make screenshots of the new sensors, and post here

Just to be sure (and not find myself in trouble with deleted history, or double entities):
When I try to delete the Enphase DEV in HACS I get a prompt that tells me the integration is being used. And that I first need to delete it as a working integration, or ignore this.


What do I choose here? And are there any other choices that I need to make afterwards that can lead to deleting history or creating double entities when I enable the core version?

Like others said; my primary goal is to keep my history and make the switch from DEV to Core seamless with no change in entities or other. Is this indeed able to achieve?

Same question from me. I’ve lost data and automations in the past switching between HACS and normal, so I want to be really sure :grimacing:

That will be impossible. The sensor naming of the core integration is completely different from the custom HACS one.

But the history of the DEV’s version will be saved, correct?
So basically this would be like adding a new solar panel string, and stop using the old one. Where the data that the old one collected is still in the history, but stops collecting data from the moment the switch takes place. And the new string takes over (with different entities).
So in the end of the year I have PV-data from 2 strings, the old one and the new one. Together they will accumulate to the total which the Enphase Envoy app will show for 2023? And from 2024 on I will only have the ‘new’ sting in Home Assistant?

In theory yes, but how this correlate with removing the old integration i don’t know… If you remove the old integration the sensors are gone too.

EDIT: sorry spoke too soon; the lifetime energy produced sensor has the same name on both integrations. So if you used that in the energy dashboard your statistic history is still available after migration

Ok here are the steps i took to succesfully have charge / discharge sensors availalble with the new core integration. You can ofcourse use your own helper naming.

Add the following helpers:

Combine state helper:
	name: Encharge Total Power 
	characteristic: Sum
	Precision: 2
        Sensors: add all encharge power sensors from your batteries

Sensor Template:
	name: Encharge Discharge Power
	state template: {{(states('sensor.encharge_total_power') | float) if states('sensor.encharge_total_power') | int > 0 else 0 }}
	unit of measurement: W
	device class: Power
	state class: Measurement

Sensor Template:
	name: Encharge Charge Power
	state template: {{(states('sensor.encharge_total_power') | float | abs) if states('sensor.encharge_total_power') | int < 1 else 0 }}
	unit of measurement: W
	device class: Power
	state class: Measurement
	
Riemann sum integral sensor:
	name: Encharge Discharge Energy
	input Sensor: sensor.encharge_discharge_power
	method: Left Riemann sum
	precision: 2
	prefix: none
	time unit: Hours

Riemann sum integral sensor:
	name: Encharge Charge Energy
	input Sensor: sensor.encharge_charge_power
	method: Left Riemann sum
	precision: 2
	prefix: none
	time unit: Hours
	
Utility Meter:
	name: Encharge Daily Discharge Energy
	input sensor: sensor.encharge_discharge_energy
	reset cycle: Daily
	offset: 0
	tariff: empty
	net consumption: On
	delta values: Off
	periodically resetting: On

Utility Meter:
	name: Encharge Daily Charge Energy
	input sensor: sensor.encharge_charge_energy
	reset cycle: Daily
	offset: 0
	tariff: empty
	net consumption: On
	delta values: Off
	periodically resetting: On

After this, if batteries are not charging / discharging set both template sensors manually to 100 for a couple of minutes (don’t forget to reset!) to make sure the helpers depend on them have valid values.
Lastly add the utility meter helpers to the energy dashboard.

To keep battery statistics run the following SQL queries on the HA db:

UPDATE statistics
SET metadata_id = (SELECT id
                      FROM   statistics_meta
                      WHERE  statistic_id = 'sensor.encharge_daily_discharge_energy')
WHERE  metadata_id = (SELECT id
                      FROM   statistics_meta
                      WHERE  statistic_id = 'sensor.envoy_xxxxxxxxxxxxx_battery_energy_charged')
					  
UPDATE statistics
SET metadata_id = (SELECT id
                      FROM   statistics_meta
                      WHERE  statistic_id = 'sensor.encharge_daily_charge_energy')
WHERE  metadata_id = (SELECT id
                      FROM   statistics_meta
                      WHERE  statistic_id = 'sensor.envoy_xxxxxxxxxxxxx_battery_energy_discharged')
2 Likes

The second post also implies that this does work. Also, I think essentially this should be possible, since the HACS integration ‘supersedes’ the internal integration. They are not completely different afaik.

Decided to bite the bullet and these are my findings so far;

  • First create a full backup (I waited until the energy dashboard got it hourly update and made a back up straight after that).
  • After the back up , follow the steps in the second post (delete the integration, restart HA…)
  • The Enphase solar panels will be discovered automatically and a notification is given.
  • Click the ‘Show discovered device’ (or something) in the notification and click ‘Configure’ in the integration screen where the Envoy Enphase Integrtion is discovered.
  • Check the IP address that is show (should be the correct one) and fill in you Enphase Cloud user and password.
  • After that all Enphase devices are visible and you are asked to add a room where these are located.
  • Fill the rooms or leave blank and after that everything is OK and working.

What I have experienced is the following;

  • The following entities are created;

    (and with every ‘sensor.inverter_123456789’ an entity is created ‘_last_reported’)
  • The energy dashboard lifetime production entity from the old one is NOT the same as the ‘new entity’ so I had to add the new one (DO NOT DELETE THE OLD ONE, because this will delete the history from the energy dashboard of that ‘old’ entity. Be assured that it will not delete the data from the database so adding the old entity as a solar production, will make the history visible again).
  • So now I have 2 entities in my energy dashboard, the old and the new one.

And for any custom cards or dashboards I have created in the past, I just had to select the new entity to replace the old one. But the cards and dashboards I have created do not show history or anything, therefore this issue described before does not apply here. But if you have custom cards with a history component, you will experience the same trouble as with the energy dashboard.

Do not know yet if there are more issues to follow, and I do not like having the old entity in my dahsboard while it does not do anything anymore other that for ‘history’ .

So not decided if I am going to do a roll back or just let this be.
Maybe someone knows how to rename the entity of the old data to the new entity, or another way to fix this?

Edit; did a roll back, mainly because I did not like the extra entity. Roll back was easy and making the switch to the core version was also easy. So if a solution is available I will try again.

1 Like

That is strange, the old lifetime sensor on my system was the same as the new one. I did not have to configure anything in the energy dashboard apart from the battery sensors…

EDIT: oh and in my previous post i explained how to update a changed sensor naming by executing some SQL queries. You can use the SQLLite Web addon for that.

That did the trick. I added the Enphase integration via the core integration like in my previous post.
The entities that are created are something like;
sensor.envoy_**123344567789_**lifetime_energy_production
sensor.inverter_12233445567
etc.

I compared these with the entities that I had when I had the DEV-version working.
I found out that I had to change the entities to the following;
sensor.envoy_**enphase_s_**lifetime_energy_production
sensor.**envoy_enphase_s_**inverter_12233445567

After I changed the entity names to the ones that were similar to the ones in DEV, everything started working again.

The only difference still is that ‘_lifetime_energy_production’ in DEV was an entity measured in Wh, while the Core-version measures it in mWh.
I changed this back to Wh, and have to test whether or not this impacts that energy dashboard and history when I change it to mWh. Because when I looked at the history while it was still mWh, the history was in Wh and therefor dropping from 3.000.000 (Wh) way down to 3.000 (which is mWh). So it appeared that the history tabel doesn’t work well with changing the measurement. Will test this later on (or if anyone knows the answer, feel free to answer this question).

Sorry for the chaotic break down or incomplete explanations. In a hurry and will add more info later…

Edit after few hours operational; everything works fine and the core integration continues its data collection on the historic entities, so transition is seamless.
Only remaining question is what happens with the new and historic data combined when I change the measurement of ‘sensor.envoy_enphase_s_lifetime_energy_production’ from Wh to mWh.
Will try that tomorrow when sun us up again and everything is active.