From 511ea09c9936c501219e7697bfb8ffee760e287c Mon Sep 17 00:00:00 2001 From: Markus Haack Date: Wed, 23 Sep 2020 04:04:01 +0200 Subject: [PATCH] Guard SolarEdge for inverters without batteries (#40295) --- homeassistant/components/solaredge/sensor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/solaredge/sensor.py b/homeassistant/components/solaredge/sensor.py index 3888b8bf536..2b085d1ba40 100644 --- a/homeassistant/components/solaredge/sensor.py +++ b/homeassistant/components/solaredge/sensor.py @@ -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: