Fix solaredge service data KeyError (#40653)

This commit is contained in:
Maikel Punie authored and GitHub committed 2020-09-27 11:40:56 +02:00
1 parent 66a8edb11e
commit b65583084b
1 file changed
+3 -3
+3 -3
View File
@@ -149,7 +149,7 @@ class SolarEdgeOverviewSensor(SolarEdgeSensor):
def update(self):
"""Get the latest data from the sensor and update the state."""
self.data_service.update()
self._state = self.data_service.data[self._json_key]
self._state = self.data_service.data.get(self._json_key)
class SolarEdgeDetailsSensor(SolarEdgeSensor):
@@ -192,8 +192,8 @@ class SolarEdgeInventorySensor(SolarEdgeSensor):
def update(self):
"""Get the latest inventory data and update state and attributes."""
self.data_service.update()
self._state = self.data_service.data[self._json_key]
self._attributes = self.data_service.attributes[self._json_key]
self._state = self.data_service.data.get(self._json_key)
self._attributes = self.data_service.attributes.get(self._json_key)
class SolarEdgeEnergyDetailsSensor(SolarEdgeSensor):