home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.88k stars 30.95k forks source link

Envoy Enphase integration : managing both ACB and Encharge batteries ? #130879

Open rezzalex opened 4 days ago

rezzalex commented 4 days ago

The problem

I have an Enphase set-up with both ACB batteries and Encharge 3T batteries. I can see only 1 battery level in HA which seems to be only the Encharge one.

What version of Home Assistant Core has the issue?

core-2024.11.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Enphase Envoy

Link to integration documentation on our website

https://www.home-assistant.io/integrations/enphase_envoy

Diagnostics information

config_entry-enphase_envoy-01JC3CMDVGSWMRNRM4JVWTB6WF.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

I can tell (from Domoticz Enphase plugin integration) that the answer lies into the enphase API : /ivp/livedata/status

cb_agg_soc : % level of ACB batteries enc_agg_soc : % level of Encharge IQ 3T batteries soc : average

I am interested in the average of my 2 differents batteries.

home-assistant[bot] commented 4 days ago

Hey there @bdraco, @cgarwood, @joostlek, @catsmanac, mind taking a look at this issue as it has been labeled with an integration (enphase_envoy) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `enphase_envoy` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign enphase_envoy` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


enphase_envoy documentation enphase_envoy source (message by IssueLinks)

catsmanac commented 4 days ago

Hi @rezzalex, your the first one I know of asking for these ACB batteries. We don't have these currently in the data model, but I see the data in the raw data requested from the Envoy.

Which means it's gonna take some code changes. Before we embark on that can you answer some exploring questions so we can move in the right direction.

In the Envoy production report in your diagnostics file I see:

"storage": [
  {
    "type": "acb",
    "activeCount": 3,
    "readingTime": 1731943992,
    "wNow": 260,
    "whNow": 930,
    "state": "discharging",
    "percentFull": 25
  }
]

And in the Encharge data, the ACB soc and energy content is included as well.

"ACB_agg_soc": 25,
"ACB_agg_energy": 930,

I think all this translate to:

For the Encharge batteries I see

"percentFull": 54,

And

"ENC_agg_soc": 54,

"ENC_agg_avail_energy": 1890,
"Enc_commissioned_capacity": 3500,
"Enc_max_available_capacity": 3500,

Combined capacity is then 3500 + 3720 = 7220 Wh. The latter is also reported by Encharge

"agg_soc": 39,
"Max_energy": 7220,

Agg_soc of 39% of 7220 is 2815 Wh which is roughly the ACB 930 Wh + the Encharge 1890 Wh

Can you confirm these numbers?

rezzalex commented 4 days ago

Hello @catsmanac ,

thanks a lot for your quick answer, already performed investigation and the will to take into account my probably rare enphase set-up.

ALL your hypothesis and numbers are correct, except that in the API I have mentioned (/ivp/livedata/status), there is no agg_soc, only soc

if it can help : https://github.com/domoticz/domoticz/issues/5798

catsmanac commented 3 days ago

Thanks for the link @rezzalex, that contains lot's of background info. We won't use the /ivp/livedata/status as that does not provide any data if no CT are installed (as on my PV Only Envoy non-metered). Since I found the same information in what we collect already that should not be an issue.

Since ACB batteries report aggregated and not like Encharge, each individual, I would think to add these as a single ACB device with current Power, Capacity, soc and state.

And then, if both Encharge and ACB batteries exist, add an Aggregate SOC to to the envoy device showing the combined soc of encharge and ACB batteries.

Does that match with what you have in mind?

rezzalex commented 3 days ago

That would be perfect indeed.

In my case, I am only interested in the aggregated state of charge (SOC), specifically the percentage of charge and the "instant" power that can flow in and out.

However, what you described seems to cover all possible Envoy Enphase possible set_up

catsmanac commented 3 days ago

To test any new code for this case, I would appreciate if you can provide a diagnostics file that includes test fixture data. To provide such data, if you are willing to, go to settings / devices & services / Enphase Envoy and click the configure option for the Envoy.

Then enable the option to include test fixture data in the diagnostic report. afbeelding

Then geta fresh diagnostics report that now will include the needed data to build test cases. Afterwards undo the configured option again as gathering the test data makes report creation somewhat slower and is not required for standard troubleshooting.

rezzalex commented 2 days ago

Hello @catsmanac ,

is it what you are looking for ? config_entry-enphase_envoy-01JC3CMDVGSWMRNRM4JVWTB6WF (1).json

catsmanac commented 2 days ago

Thanks @rezzalex, that's exactly it.

What will happen next:

As you can see from the list, it will take some steps and time. Sometimes all moves quickly, something it takes longer. All involved are volunteers so availability varies.

rezzalex commented 2 days ago

thanks for the transparency

catsmanac commented 2 days ago

Looking at the data it seems the ACB batteries are currently empty and in idle state. Is that correct?

    "storage": [
        {
            "type": "acb",
            "activeCount": 3,
            "readingTime": 1732089607,
            "wNow": -15,
            "whNow": 0,
            "state": "idle",
            "percentFull": 0
        }
    ]

Combined overall SOC is at 4%, the 3T Encharge battery SOC at 10%. Combined avaialble energy at 350Wh (from the 3T)

    "agg_soc": 4,
    "Max_energy": 7220,
    "ENC_agg_soc": 10,
    "ENC_agg_soh": 100,
    "ENC_agg_backup_energy": 0,
    "ENC_agg_avail_energy": 350,
    "Enc_commissioned_capacity": 3500,
    "Enc_max_available_capacity": 3500,
    "ACB_agg_soc": 0,
    "ACB_agg_energy": 0,
rezzalex commented 2 days ago

right now, enphase mobile app show me 7% on the livestatus screen and 5% on the first "state" screen

the battery details screen shows GLOBAL : 5%, and available energy : 0,45 of 7,22kwh power : 1,28 of 1,28 kwh

each ACB battery is at 1%

encharge at 12% available energy : 0,42 of 3,5 kwh

I hope it helps

catsmanac commented 2 days ago

Yes, those numbers are close enough to match what is in the diagnostics and build some test cases from.

catsmanac commented 1 day ago

First 2 steps completed.

catsmanac commented 10 hours ago

This would be the concept, @rezzalex.

There's an ACB device that shows soc, state en power for the ACB batteries. The existing Encharge batteries remain unchanged. The Envoy data now has 4 new entities, 3 for the overall aggregated data from ACB and Encharge baterries and 1 for the current available ACB batteries energy.

Schermafbeelding 2024-11-22 131654