mirror of
https://github.com/home-assistant/core.git
synced 2025-06-25 01:21:51 +02:00
Ambient Weather: Check for key existence before checking value (#115776)
This commit is contained in:
@ -49,7 +49,7 @@ class AmbientWeatherEntity(Entity):
|
||||
last_data = self._ambient.stations[self._mac_address][ATTR_LAST_DATA]
|
||||
key = self.entity_description.key
|
||||
available_key = TYPE_SOLARRADIATION if key == TYPE_SOLARRADIATION_LX else key
|
||||
self._attr_available = last_data[available_key] is not None
|
||||
self._attr_available = last_data.get(available_key) is not None
|
||||
self.update_from_latest_data()
|
||||
self.async_write_ha_state()
|
||||
|
||||
|
Reference in New Issue
Block a user