-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Enphase Envoy-S Metered Integration Bug - Failed Setup #142015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey there @bdraco, @cgarwood, @joostlek, @catsmanac, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) enphase_envoy documentation |
The formatted json looks like below. Current logic tries to read meter["measurementType"] before testing for "activeCount" > 0. Needs a change in pyenphase library. {
"production": [{
"type": "inverters",
"wNow": 1406,
"whLifetime": 11420402.10388889,
"readingTime": 1743529602,
"activeCount": 19
}, {
"type": "eim",
"activeCount": 1,
"whLifetime": 8593158.949,
"whLastSevenDays": 5734.949,
"whToday": 5116.949,
"wNow": 1377.422,
"rmsCurrent": 11.486,
"rmsVoltage": 243.419,
"reactPwr": 241.26,
"apprntPwr": 1397.953,
"pwrFactor": 0.99,
"readingTime": 1743529602
}
],
"consumption": [{
"type": "eim",
"activeCount": 0,
"whLifetime": 0,
"whLastSevenDays": 0,
"whToday": 0,
"wNow": 0,
"varhLeadToday": 0,
"varhLagToday": 0,
"vahToday": 0,
"varhLeadLifetime": 0,
"varhLagLifetime": 0,
"vahLifetime": 0,
"rmsCurrent": 0,
"rmsVoltage": 0,
"reactPwr": 0,
"apprntPwr": 0,
"pwrFactor": 0
}
]
} |
@catsmanac I have zero prior experience with this, so I'm not 100% sure I did it right, but I managed to override the core enphase_envoy integration by duplicating the enphase_envoy files in the custom_components folder and then pointed the manifest at your pyenphase pull request branch. Good news and bad news. The good news is I'm seeing authenticated connections now, 200 responses, and production data being pulled(!!!), but I see another json key error down the line:
My /ivp/meters json response: [
{
"eid": 704643328,
"state": "enabled",
"measurementType": "production",
"phaseMode": "split",
"phaseCount": 2,
"meteringStatus": "normal"
},
{
"eid": 704643584,
"state": "disabled",
"measurementType": "net-consumption",
"phaseMode": "split",
"phaseCount": 2,
"meteringStatus": "not-metering"
}
] and my /ivp/meters/readings json: [
{
"eid": 704643328,
"timestamp": 1743564539,
"actEnergyDlvd": 8598256.633,
"actEnergyRcvd": 15440.826,
"apparentEnergy": 12039113.426,
"reactEnergyLagg": 4797575.856,
"reactEnergyLead": 2.593,
"instantaneousDemand": -8.51,
"activePower": -8.51,
"apparentPower": 211.47,
"reactivePower": 204.68,
"pwrFactor": -0.04,
"voltage": 242.10,
"current": 1.75,
"freq": 60.00,
"channels": [
{
"eid": 1778385169,
"timestamp": 1743564539,
"actEnergyDlvd": 4289410.853,
"actEnergyRcvd": 10354.238,
"apparentEnergy": 6009977.620,
"reactEnergyLagg": 2407363.257,
"reactEnergyLead": 1.556,
"instantaneousDemand": -5.15,
"activePower": -5.15,
"apparentPower": 107.28,
"reactivePower": 103.84,
"pwrFactor": -0.05,
"voltage": 121.42,
"current": 0.88,
"freq": 60.00
},
{
"eid": 1778385170,
"timestamp": 1743564539,
"actEnergyDlvd": 4308845.780,
"actEnergyRcvd": 5086.589,
"apparentEnergy": 6029135.806,
"reactEnergyLagg": 2390212.598,
"reactEnergyLead": 1.038,
"instantaneousDemand": -3.36,
"activePower": -3.36,
"apparentPower": 104.19,
"reactivePower": 100.83,
"pwrFactor": -0.03,
"voltage": 120.68,
"current": 0.86,
"freq": 60.00
},
{
"eid": 1778385171,
"timestamp": 1743564539,
"actEnergyDlvd": 0.000,
"actEnergyRcvd": 0.000,
"apparentEnergy": 0.000,
"reactEnergyLagg": 0.000,
"reactEnergyLead": 0.000,
"instantaneousDemand": 0.00,
"activePower": 0.00,
"apparentPower": 0.00,
"reactivePower": 0.00,
"pwrFactor": 0.00,
"voltage": 0.00,
"current": 0.00,
"freq": 60.00
}
]
}
]
Looks like maybe this line is this issue here? Maybe update to something like this?: status_flags=meter_status.get("statusFlags", None), |
Smart move on that testing :-), helps a lot. Yes, something like that. I've updated the PR with such a change for a next try. I've added the data from your log file to the test fixture for this as well. We may need some more iterations on this. Looking at the data it seems the envoy setup is continuing from it's old configuration. The current lifetime production value shows 8.5 MWh. The list of inverters reports 51 inverters, of which only the first 7 report with current timestamp. All other 44 report with a 2018 timestamp. This will result in a total of 51 inverters in HA of which 44 will be stuck on that old last value. |
Hey @catsmanac - Just want to confirm that everything is working great with your latest updates. I'm seeing the integration succeeding and a bunch of entities getting added and it looks like Wattage values are updating! So you definitely have my seal of approval! My next question is should these have nice names when the integration is added, or is this possibly another issue? I see on my dashboard that the sensor values associated with the gateway all have generic names 'Energy' and 'Power'... Like Envoy 123456780 Energy , and the inverter entity names are: Inverter 1122334455 etc. With regard to your other statement- I definitely have a long list of 'deleted' inverters in my Envoy gateway page as these were from the previous owner, and they did unfortunately show up as entities with essentially non-changing wattages in HA. I don't see a way to truly delete them from my Envoy (perhaps there is some hard reboot method somewhere?), but does the integration for more modern versions of Envoys prevent the retired inverters from being added as entities on init of the integration? If so, I can help provide more API responses (I see some from the logged in installer page that would probably be helpful in this). Otherwise, this would just be a new feature. |
Ah great, I'll move it to production for an upcoming release. Can you get me a diagnostics file with test fixtures enabled so I can make sure our test fixture fully represent this case? On the HA Enphase envoy integration page use the configure option Then in the
The inverter names are as expected, the energy and power names should be longer. What does show in the entity properties?
The integration adds all inverters reported by the Envoy. I've seen it happen with modern firmwares as well with a change in inverters, when old inverters were not removed from the configuration. There is an endpoint /inventory.json on the Envoy. That shows all components it knows. Check if the old ones are in there as well. If so maybe there are some fields that can assist in detecting status of an envoy. The last reported timestamp of the inverter itself could be used as an indicator as well. And another easy method is In HA disabling the entities for these inverters and they will not be used anymore. |
Diagnostics: config_entry-enphase_envoy-01JQVSJRBVK75A6VTBX9EYR4T8.json I don't really see any additional metadata anywhere for the energy/power names: As far as active/inactive, it looks like there is envoy.local/inventory.json and envoy.local/inventory.json?deleted=1. The latter endpoint gives all of the inverters and includes deleted (in Envoy installer page, at least on my firmware, I can set inverters to 'deleted' though there is no way to fully remove them', and the first /inventory.json just provides active ones. Including those json's here: Maybe 'admin_state' is the answer to this one. |
As for the names, I think that may be caused by the custom integration having no translations!? Copy strings.json to en.json in a translations sub folder (custom_components/enphase_envoy/translations/en.json) and cycle HA. |
Ah that translation folder/file fixed it! The names show up now. |
Can you read these using /inventory or do you need to use /inventory.json? So the inventory has the active ones and could be a reference. Need to asses if or how to use. As said, you can disable the inverter device or inverter entities in HA. |
The problem
I recently purchased a used Envoy-S Metered to work with my M-Series Enphase microinverters- it has detected the micros, and it has a CT for PV production (nothing for consumption yet, thought I suspect the previous owner had used the consumption CT at some point- perhaps the Envoy thinks it's missing and is doing something with the data).
The Envoy looks like it’s running firmware version M4.2.33 (pretty old!), and I’m able to access quite a bit of data just off the bat with no auth, as well as the installer/admin side of things using ‘installer’ and the installer password pulled using that python script :).
All that said, I’m not able to get the Home Assistant integration working. The integration looks like it’s connecting, but I’m seeing an immediate error: “Failed setup, will retry: ‘measurementType’” . I’ve tried every combination of username password to see if it makes any difference, and it doesn’t seem to do anything.
Looking at the diagnostic logs, it looks like it’s looking for a json key that doesn’t exist:
Unexpected error fetching Envoy 123456789 data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 380, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/enphase_envoy/coordinator.py", line 196, in _async_update_data envoy_data = await envoy.update() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/pyenphase/envoy.py", line 621, in update await self.probe() File "/usr/local/lib/python3.13/site-packages/pyenphase/envoy.py", line 560, in probe if updater_features := await klass.probe(supported_features): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/pyenphase/updaters/production.py", line 105, in probe meter_type = meter["measurementType"] ~~~~~^^^^^^^^^^^^^^^^^^^ KeyError: 'measurementType'
Additionally, this is an example production.json from my Envoy (envoy.local/production.json):
{"production":[{"type":"inverters","wNow":1406,"whLifetime":11420402.10388889,"readingTime":1743529602,"activeCount":19},{"type":"eim","activeCount":1,"whLifetime":8593158.949,"whLastSevenDays":5734.949,"whToday":5116.949,"wNow":1377.422,"rmsCurrent":11.486,"rmsVoltage":243.419,"reactPwr":241.26,"apprntPwr":1397.953,"pwrFactor":0.99,"readingTime":1743529602}],"consumption":[{"type":"eim","activeCount":0,"whLifetime":0,"whLastSevenDays":0,"whToday":0,"wNow":0,"varhLeadToday":0,"varhLagToday":0,"vahToday":0,"varhLeadLifetime":0,"varhLagLifetime":0,"vahLifetime":0,"rmsCurrent":0,"rmsVoltage":0,"reactPwr":0,"apprntPwr":0,"pwrFactor":0}]}
What version of Home Assistant Core has the issue?
core-2025.3.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Enphase Envoy
Link to integration documentation on our website
https://www.home-assistant.io/integrations/enphase_envoy
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response
The text was updated successfully, but these errors were encountered: