From 8ecbb858524145dd7bef9be74a3d8fc9d8366c1c Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Wed, 10 Aug 2022 21:05:09 -0400 Subject: [PATCH] Use generators for async_add_entities in Ambient Station (#76586) --- .../components/ambient_station/binary_sensor.py | 14 ++++++-------- homeassistant/components/ambient_station/sensor.py | 10 ++++------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/homeassistant/components/ambient_station/binary_sensor.py b/homeassistant/components/ambient_station/binary_sensor.py index 4380e1839f2..bcc2ae60404 100644 --- a/homeassistant/components/ambient_station/binary_sensor.py +++ b/homeassistant/components/ambient_station/binary_sensor.py @@ -333,14 +333,12 @@ async def async_setup_entry( ambient = hass.data[DOMAIN][entry.entry_id] async_add_entities( - [ - AmbientWeatherBinarySensor( - ambient, mac_address, station[ATTR_NAME], description - ) - for mac_address, station in ambient.stations.items() - for description in BINARY_SENSOR_DESCRIPTIONS - if description.key in station[ATTR_LAST_DATA] - ] + AmbientWeatherBinarySensor( + ambient, mac_address, station[ATTR_NAME], description + ) + for mac_address, station in ambient.stations.items() + for description in BINARY_SENSOR_DESCRIPTIONS + if description.key in station[ATTR_LAST_DATA] ) diff --git a/homeassistant/components/ambient_station/sensor.py b/homeassistant/components/ambient_station/sensor.py index 4eae53b6a03..1a51e57bfa3 100644 --- a/homeassistant/components/ambient_station/sensor.py +++ b/homeassistant/components/ambient_station/sensor.py @@ -646,12 +646,10 @@ async def async_setup_entry( ambient = hass.data[DOMAIN][entry.entry_id] async_add_entities( - [ - AmbientWeatherSensor(ambient, mac_address, station[ATTR_NAME], description) - for mac_address, station in ambient.stations.items() - for description in SENSOR_DESCRIPTIONS - if description.key in station[ATTR_LAST_DATA] - ] + AmbientWeatherSensor(ambient, mac_address, station[ATTR_NAME], description) + for mac_address, station in ambient.stations.items() + for description in SENSOR_DESCRIPTIONS + if description.key in station[ATTR_LAST_DATA] )