From 03d8abe1ba22d5a536039a4881eba702eba1fb9c Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Thu, 27 Feb 2020 22:40:51 -0700 Subject: [PATCH] Fix unhandled exception in Ambient PWS_URL (#32238) * Fix unhandled exception in Ambient PWS_URL * Comment update * Be more explicit --- homeassistant/components/ambient_station/sensor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/ambient_station/sensor.py b/homeassistant/components/ambient_station/sensor.py index 6dc79cec326..c400d2ec97b 100644 --- a/homeassistant/components/ambient_station/sensor.py +++ b/homeassistant/components/ambient_station/sensor.py @@ -83,7 +83,11 @@ class AmbientWeatherSensor(AmbientWeatherEntity): w_m2_brightness_val = self._ambient.stations[self._mac_address][ ATTR_LAST_DATA ].get(TYPE_SOLARRADIATION) - self._state = round(float(w_m2_brightness_val) / 0.0079) + + if w_m2_brightness_val is None: + self._state = None + else: + self._state = round(float(w_m2_brightness_val) / 0.0079) else: self._state = self._ambient.stations[self._mac_address][ATTR_LAST_DATA].get( self._sensor_type