Fix unhandled exception in Ambient PWS_URL (#32238)

* Fix unhandled exception in Ambient PWS_URL

* Comment update

* Be more explicit
pull/32368/head
Aaron Bach 2020-02-27 22:40:51 -07:00 committed by GitHub
parent 0364cd8db5
commit 03d8abe1ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -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