Do no crash Luftdaten on additional data returned by the API (#37763)

This commit is contained in:
Jannik Beyerstedt 2020-07-14 22:56:02 +02:00 committed by GitHub
parent 5b3d094a1e
commit d8c2732bcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,7 +30,12 @@ async def async_setup_entry(hass, entry, async_add_entities):
sensors = []
for sensor_type in luftdaten.sensor_conditions:
name, icon, unit = SENSORS[sensor_type]
try:
name, icon, unit = SENSORS[sensor_type]
except KeyError:
_LOGGER.debug("Unknown sensor value type: %s", sensor_type)
continue
sensors.append(
LuftdatenSensor(
luftdaten, sensor_type, name, icon, unit, entry.data[CONF_SHOW_ON_MAP]