Fix solaredge-local protobuf exception (#92090)

This commit is contained in:
Rajeevan 2023-04-29 11:33:43 +02:00 committed by GitHub
parent 7dfbfd45ae
commit 44186bb731
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -5,5 +5,5 @@
"documentation": "https://www.home-assistant.io/integrations/solaredge_local", "documentation": "https://www.home-assistant.io/integrations/solaredge_local",
"iot_class": "local_polling", "iot_class": "local_polling",
"loggers": ["solaredge_local"], "loggers": ["solaredge_local"],
"requirements": ["solaredge-local==0.2.0"] "requirements": ["solaredge-local==0.2.3"]
} }

View file

@ -290,7 +290,7 @@ class SolarEdgeSensor(SensorEntity):
"""Return the state attributes.""" """Return the state attributes."""
if extra_attr := self.entity_description.extra_attribute: if extra_attr := self.entity_description.extra_attribute:
try: try:
return {extra_attr: self._data.info[self.entity_description.key]} return {extra_attr: self._data.info.get(self.entity_description.key)}
except KeyError: except KeyError:
pass pass
return None return None
@ -298,7 +298,7 @@ class SolarEdgeSensor(SensorEntity):
def update(self) -> None: def update(self) -> None:
"""Get the latest data from the sensor and update the state.""" """Get the latest data from the sensor and update the state."""
self._data.update() self._data.update()
self._attr_native_value = self._data.data[self.entity_description.key] self._attr_native_value = self._data.data.get(self.entity_description.key)
class SolarEdgeData: class SolarEdgeData:

View file

@ -2369,7 +2369,7 @@ snapcast==2.3.2
soco==0.29.1 soco==0.29.1
# homeassistant.components.solaredge_local # homeassistant.components.solaredge_local
solaredge-local==0.2.0 solaredge-local==0.2.3
# homeassistant.components.solaredge # homeassistant.components.solaredge
solaredge==0.0.2 solaredge==0.0.2