core: Enphase Envoy integration KeyError
The problem
I’m getting a KeyError a few times per day with the Enphase Envoy integration. Seven errors over the last two days. Per the traceback below, it is not finding my serial number.
The Production Right Now and Production Lifetime sensors appear to be working properly, but the Production Today and Production Last Seven Days values are two days old - roughly the time of the first error.
What version of Home Assistant Core has the issue?
2023.11.2
What was the last working version of Home Assistant Core?
unknown, just installed
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
config_entry-enphase_envoy-59493540ff4b0613c1e0ae0424d2df37.json.txt
Example YAML snippet
n/a
Anything in the logs that might be useful for us?
Logger: homeassistant
Source: components/enphase_envoy/sensor.py:486
First occurred: November 10, 2023 at 10:18:16 PM (7 occurrences)
Last logged: 4:40:10 AM
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 233, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 389, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 172, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 469, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 743, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 843, in _async_write_ha_state
state, attr = self._async_generate_attributes()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in _async_generate_attributes
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 749, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 501, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/enphase_envoy/sensor.py", line 486, in native_value
return self.entity_description.value_fn(inverters[self._serial_number])
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
KeyError: '<<<my serial number>>>'
### Additional information
_No response_
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Comments: 27 (26 by maintainers)
The error was still happening as-of this morning. However, after turning on debug logging and restarting HA, the error has not returned (6+ hours later). I’ll let it run a few days and check on it again.