briancmpbll / home_assistant_custom_envoy

171 stars 76 forks source link

Incorrect current consumption #169

Open superpower10 opened 8 months ago

superpower10 commented 8 months ago

I have Envoy-S and connected with Enlighten Log-In. I tried both methods (JSON and no JSON)

The current consumption value are not even close to be correct: actual current consumption

current consumption

It seems to sum the current power consumption with the power that goes into the battery.

catsmanac commented 8 months ago

Can you add some detail. Is the top picture your HA Energy dashboard or is the Enphase App? Power is varying a lot and can change quickly. Are all sources from same timestamp?

The integration is providing the Envoy data as is. Only the Battery Energy charged and discharged is calculated from the changes in battery capacity.

In the diagnostics file you can find the raw data as received. Here is described how to get it. Feel free to share here if you would like for me to look at it.

Hoffmann77 commented 8 months ago

I can confirm that the Power Consumption includes the power going into the batteries.

catsmanac commented 8 months ago

Seems logic as it is power generated but not leaving to the grid, so Envoy thinks it's in the (total) consumption which is assigned to the home.

superpower10 commented 8 months ago

@catsmanac

  1. The Top Picture is from the Enphase App
  2. The power consumption and production was very constant at that time. Yes it varying but not that much.

For me its not logic. Current Consumption is - as you see in the app - the power I need in the house at the moment. Combined would be the current power produced by the solar panels.

catsmanac commented 8 months ago

Did you validate the numbers with the diagnostic file to confirm these match the data from the Envoy?

superpower10 commented 8 months ago

I checked and the integration shows exactly what the json says.

Example from today: "data": { "production": 1795, "consumption": 1854, "net_consumption": 58,

And the consumption value is shown in the dashboard.

Is the JSON directly from the Gateway/Enphase or is it processed by the integration first?

catsmanac commented 8 months ago

The integration is not processing values, only assigning them to entities.

To see all the raw data that came from the envoy look for the section with endpoints. Values from there end-up in the data sections. (but not all of them)

afbeelding

testuser7 commented 8 months ago

@superpower10 You compare the current readings [W] with the daily ones [kW] presented in the Enlighten application.

superpower10 commented 8 months ago

As written here https://github.com/jrutski/home_assistant_envoy_d7_fw that values can‘t be correct.

Enphase needs to open up and give information to the API.

catsmanac commented 8 months ago

I assume you are referring to his notes, your link didn't work for me for some reason. And he is right and @Hoffmann77 confirmed that as well. When installing the consumption CT at grid entry point and the Production CT on the solar production, then house consumption will include what went into the battery.

In Home assistant you can use the energy dashboard to handle this. Specify the lifetime net consumption for grid consumption and lifetime net production as Return to Grid and the battery energy charged / discharged for the Home Battery Storage.

The new Home Assistant Core Envoy integration has now battery support as well, so you may want to look at that one. It doesn't have multi phase yet, that is coming, not sure when.

testuser7 commented 8 months ago

@catsmanac Do the changes that go to Core come from this plugin?

catsmanac commented 8 months ago

@testuser7, not directly. The core one now uses a new python package pyenphase build by the new owners of the Home Assistant Envoy integration. So it's a 2 step process, pyenphase may need an update top collect the required data and then HA Integration needs an update to add the new entities.

I created PR 105 for pyenphase to add the meters page to obtain phase count in use and that is added to pyenphase. Then there's a next PR 108 to add the phase values information to pyenphase based on the concept from this plugin, but using the pyenphase code. Then a subsequent PR will be created to also add the meters/readings page to get grid import/export.

Technically HA Envoy integration can grab phase data with pyenphase version 1.14.0 that has the phase_count, but the PR 108 will make it available without the need to parse the raw JSON in HA Core.

And haven't bothered yet about PR in HA Core Envoy integration to add phase and grid data, one step at a time.

So long answer short, I'm forwarding the concepts, but code is implemented different as the pyenphase has a new codebase.

testuser7 commented 8 months ago

Thank you for the detailed information :)

Hoffmann77 commented 8 months ago

@superpower10 to represent the consumption as detailed as in the Enphase app, an endpoint providing solar production, grid import/export and battery power is required.

Currently the only known endpoint providing this data is "/ivp/livedata/status". Unfortunately the endpoint needs to be activated by calling "/ivp/livedata/stream", is only active for a limited time and from my understanding it's sending data to the Enphase cloud via mqtt.

I think it's the actual endpoint that gets used if you start the live view in your Enphase app. Due to these downsides of the endpoint it's not used by any of the Enphase integrations I'm aware of right now.

But it seems like there are some integrations that are specialized on capitalizing this endpoint https://github.com/vk2him/Enphase-Envoy-mqtt-json.

Otherwise maybe you could use an integration providing battery power and subtract that value from the consumption value. But I'm not a home-assistant export so I'm not sure if that's possible.