Fix unhandled exception in Ambient PWS_URL (#32238)
* Fix unhandled exception in Ambient PWS_URL * Comment update * Be more explicit
This commit is contained in:
parent
0364cd8db5
commit
03d8abe1ba
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue