Use generators for async_add_entities in Ambient Station (#76586)
This commit is contained in:
parent
519d478d61
commit
8ecbb85852
2 changed files with 10 additions and 14 deletions
|
@ -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]
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -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]
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue