briancmpbll / home_assistant_custom_envoy

171 stars 76 forks source link

Current and Today's Energy Production with strange values/behaviour #180

Open benjamimpitacho opened 4 months ago

benjamimpitacho commented 4 months ago

I'm using the variables sensor.envoy_xxx_current_power_production and sensor.envoy_xxx_today_s_energy_production to show my production /current and daily) and same for consumption.

Consumption is OK and matches the Enphase app values. But production doesn't and looking into the history, seems to be something static/constant, which doesn't make sense.

Current Energy Production - no matter the time (even at nigth), the value shows always 1 and the chart has this look: image

Today's Energy Production - similar issue - it seems to increment 1 unit each ~40 minutes, no matter if it's nigth and my daily production is everyday 35Wh image

Gateway: Envoy-S-Meter-EU (firmware D7.6.175) Microinverters: IQ7+ (firmware 520-00082-r01-v04.27.04 / 540-00135-r01-v04.27.10)

What I'm doing wrong? Can you help me understand this behaviour?

Thanks.

catsmanac commented 4 months ago

Does your Envoy-S-Metered have current transformers (CT) installed and enabled or are you not using these?

benjamimpitacho commented 4 months ago

I have a CT for consumption (is connected to consumption terminal block) but no CT connected to production terminals. Nevertheless my gateway (and app) is reporting production correctly - do I need the CT? the Gateway seems to already have this information. I've exported a report from gateway and it also shows valid production values, zeros at nigth, etc. I also have wires connected to L1 but on Home Assistant, can't find/use the Envoy Current Power Production L sensor - is that normal? Probably L1 will give me the correct production values...

catsmanac commented 4 months ago

This Integration will recognize and handle Envoy-s Metered without CT and with 2 CT's. With only a consumption CT it's obtaining the production data from the location where normally the production CT data is reported. As it's missing the values there, these don't mean much, hence your numbers. I need to check again what the logic actually does in this case, but would need the diagnostic report for your envoy. You can download it to your workstation, edit it to remove anything you don't want to share, save as text file and upload it here as file by dropping/uploading the file in the 'paste, drop, or click to add files` box at the bottom of the comment box. (not as text pasted in the comment box)

As for the phase data, that is only shown if there's more then 1 phase, otherwise overall data and L1 data is the same and will just create more history without added value. So use the 'Envoy Current Power Production' one.

For the solar energy dashboard you best use the lifetime energy production if that is providing data.

benjamimpitacho commented 4 months ago

@catsmanac here is my log file.

config_entry-enphase_envoy-log.txt

Thanks for your help.

catsmanac commented 4 months ago

It looks as if the non-existing production CT is configured as existing and it's numbers are used. If there's no CT it should show as disabled.

It seems as if the consumption CT is reporting energy flows in 2 direction, but it configured for a spot where one would only expect 1 direction energy. Where is the consumption CT installed, between switchboard and grid or between switchboard and the house?

Details (used below as notepad but it gives some insight):

Looking in the data for Endpoint-meters which will tell if and how CT are available and configured; format the line to be a better readable we see:

"Endpoint-meters": [{
       "eid": 704643328,
       "state": "enabled",
       "measurementType":"production",
       "phaseMode":"three",
       "phaseCount": 1,
       "meteringStatus":"normal",
       "statusFlags": []
    }, {
       "eid": 704643584,
       "state":"enabled",
       "measurementType":"total - consumption",
       "phaseMode":"three",
       "phaseCount": 1,
       "meteringStatus":"normal",
       "statusFlags": []
    }

]

Which tells us there's a production CT meter and a total-consumption CT meter, both for 1 phase and both enabled.

In the envoy model there's 3 branches, 1: solar to the switchboard (production) 2: switchboard to the house (total-consumption) and 3: switchboard to the grid (net-consumption/net-production). With 2 ct installed, the 3th can be calculated.

You mention that the production CT is not installed, yet it is reported as enabled. That caused the integration to expect data in a specific location, but the data is stale as you observed.

As for the total-consumption CT we can find the data in the file again, look for Endpoint-meters-readings. With a bit of formatting and removing non-relevant lines, there's again 2 block, first for production and second for total consumption (match through eid field):

"Endpoint-meters-readings": [{
        "eid": 704643328,
        "timestamp": 1708006220,
        "actEnergyDlvd": 28930.765,
        "actEnergyRcvd": 0.000,
        "activePower": 1.433,
        "voltage": 247.463,
        "current": 0.089,
        "freq": 50.000,
    }, {
        "eid": 704643584,
        "timestamp": 1708006220,
        "actEnergyDlvd": 10019529.877,
        "actEnergyRcvd": 2383676.996,
        "activePower": 1168.604,
        "voltage": 247.091,
        "current": 5.641,
        "freq": 50.062,
    }
]

Ignoring the first block for the non-existing but enabled production CT, there is something that stands out for the total-consumption CT. It reports total energy in both directions, to and from the house, in actEnergyDlvd and actEnergyRcvd (Wh). Which suggests that the house is using but also returning energy to the switchboard!?

Then there's a 3th section Endpoint-production_json which is calculated by the Envoy from all data it has. Here you can see that net-consumption-whLifetime = total-consumption-whLifetime - production-whLifetime going by the 2 enabled CT meters. Again using a non-installed but enabled CT!?

"Endpoint-production_json": {
    "production": [{
            "type": "inverters",
            "activeCount": 3,
            "readingTime": 1708005738,
            "wNow": 315,
            "whLifetime": 1054161
        }, {
            "type": "eim",
            "activeCount": 1,
            "measurementType": "production",
            "readingTime": 1708006222,
            "wNow": 1.342,
            "whLifetime": 28930.765,
            "whLastSevenDays": 245.765,
        }
    ],
    "consumption": [{
            "type": "eim",
            "activeCount": 1,
            "measurementType": "total-consumption",
            "readingTime": 1708006222,
            "wNow": 1167.509,
            "whLifetime": 9920491.336,
            "whToday": 10713.336,
            "whLastSevenDays": 149647.336,
        }, {
            "type": "eim",
            "activeCount": 1,
            "measurementType": "net-consumption",
            "readingTime": 1708006222,
            "wNow": 1166.167,
            "whLifetime": 9891560.571,
            "whToday": 0,
            "whLastSevenDays": 0,
        }
benjamimpitacho commented 4 months ago

Regarding my CT, it seems to be a one way CT - installed between grid and switchboard.

"Which suggests that the house is using but also returning energy to the switchboard!?" This can be due to the fact that the cable that comes from the inverters is directly connected to the house electric network (through a normal wall socket)?! Could that be the "returning energy" source? There's no other reason for the house to "return energy" since there's no other energy production.

Don't know if these inputs helps on understanding my system...

Probably, I'm starting to conclude my installation, although it was made by professionals, doesn't have the full correct setup or configuration...need to look for some schematics on a recomended installation setup to understand if mine matches everything or there are some missing/wrong installed components.

catsmanac commented 4 months ago

If the consumption CT is installed between the switchboard and the grid it would be a net-consumption CT and 2 way can be expected. If this is indeed the case the Envoy is not setup correctly,

If the panels are plugged in a regular home home socket that can be the explanation for 2 way energy in the house consumption CT.

In the end it's producing energy that you can consume or export, so technically it's a working installation. Only question is on the production CT and why it shows as enabled. If the outlet were the panels are plugged into is on it's own breaker, it would still the production branch.

And this software is going by some assumptions on configurations, if production CT is enabled it will use it's data.

Do a search on envoy-s-installation-and-operation-manual to find installation directions

catsmanac commented 4 months ago

So this is the general model this integration is based on. And as mentioned only 2 of the 3 branches would have a CT installed. Typically, but certainly not exclusive, the net-consumption and the production one. And all can be valid configurations, it just may be this integration does not recognize them.

afbeelding

The CT will measure energy flow in both directions. In the Production CT majority of the flow is towards the switchboard, only when it is dark there's a bit of flow to the inverter for what they need to operate.

In your case with only 1 consumption CT and flow in 2 directions through it, it can be a net-consumption CT or a total-consumption CT with solar behind it as well.

afbeelding

The data for the missing Production CT is available, in the diagnostic data it is the inverters section. It reports 1 MWh lifetime versus the 29kWh for the missing production CT.

"Endpoint-production_json": {
    "production": [{
            "type": "inverters",
            "activeCount": 3,
            "readingTime": 1708005738,
            "wNow": 315,
            "whLifetime": 1054161
        },, {
            "type": "eim",
            "activeCount": 1,
            "measurementType": "production",
            "readingTime": 1708006222,
            "wNow": 1.342,
            "whLifetime": 28930.765,
            "whLastSevenDays": 245.765,
        }

Sorry for the long story again, it serves as my notepad and maybe someone benefits from it.

benjamimpitacho commented 4 months ago

Answering your two questions (my lifetime energy data): image 10Mwh consumption is correct. 2.4Mwh production isn't (correct one is 3.4Mwh). You can confirm the data on the image.