Guard SolarEdge for inverters without batteries (#40295)

pull/40571/head
Markus Haack 2020-09-23 04:04:01 +02:00 committed by Franck Nijhof
parent a5f00d1db2
commit 3efda8d1d2
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
1 changed files with 2 additions and 1 deletions

View File

@ -267,7 +267,8 @@ class SolarEdgeStorageLevelSensor(SolarEdgeSensor):
"""Get the latest inventory data and update state and attributes."""
self.data_service.update()
attr = self.data_service.attributes.get(self._json_key)
self._state = attr["soc"]
if attr and "soc" in attr:
self._state = attr["soc"]
class SolarEdgeDataService: