-
-
Notifications
You must be signed in to change notification settings - Fork 29k
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
Catch missing inverter in Enphase Envoy #106730
Conversation
Some envoy fw versions return an empty inverter array every 4 hours when no production is taking place. Prevent collection failure due to this as other data seems fine. Inveretrs will show unknown during this cycle.
Hey there @bdraco, @cgarwood, @dgomes, @joostlek, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the warning for the user? Can we maybe work with surpress
(check #97617 for an example)?
I can't remember the state of the integration tests, but can we maybe have a testcase for this? (if we have tests)
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Oh and an alternative: check if the inverter is in the list, if not, return None. This would at least prevent us from using a try catch |
We can make it like a debug or none at all. But if user has like a state change detection that would fire, there's no lead on what is going on. Hence the choice for a warning. But debug can work too, they would have to enable debug and then wait for it again.
This is like a blip during collection cycles. Current tests focus on single collection to configure all entities. Didn't find a decent way to do tests. Locally I used a simulator that would just insert an empty array during a 'life' test. |
Done and changed warning to debug. |
* bug: prevent invalid key when empty invereter arrays is returned. Some envoy fw versions return an empty inverter array every 4 hours when no production is taking place. Prevent collection failure due to this as other data seems fine. Inveretrs will show unknown during this cycle. * refactor: replace try/catch with test and make warning debug * Update homeassistant/components/enphase_envoy/sensor.py * Update homeassistant/components/enphase_envoy/sensor.py --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Proposed change
Some envoy fw versions return an empty inverter array
every 4 hours when no production is taking place.
Prevent collection failure due to this as other data
seems fine. Inverters will show unknown during this one cycle.
Log file will now show warning when this occurs:
Inverter xyz not in returned inverters array (size: 0)
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: