mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 05:47:10 +00:00
Use generators for async_add_entities in Ambient Station (#76586)
This commit is contained in:
parent
519d478d61
commit
8ecbb85852
@ -333,14 +333,12 @@ async def async_setup_entry(
|
|||||||
ambient = hass.data[DOMAIN][entry.entry_id]
|
ambient = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
[
|
AmbientWeatherBinarySensor(
|
||||||
AmbientWeatherBinarySensor(
|
ambient, mac_address, station[ATTR_NAME], description
|
||||||
ambient, mac_address, station[ATTR_NAME], description
|
)
|
||||||
)
|
for mac_address, station in ambient.stations.items()
|
||||||
for mac_address, station in ambient.stations.items()
|
for description in BINARY_SENSOR_DESCRIPTIONS
|
||||||
for description in BINARY_SENSOR_DESCRIPTIONS
|
if description.key in station[ATTR_LAST_DATA]
|
||||||
if description.key in station[ATTR_LAST_DATA]
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -646,12 +646,10 @@ async def async_setup_entry(
|
|||||||
ambient = hass.data[DOMAIN][entry.entry_id]
|
ambient = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
[
|
AmbientWeatherSensor(ambient, mac_address, station[ATTR_NAME], description)
|
||||||
AmbientWeatherSensor(ambient, mac_address, station[ATTR_NAME], description)
|
for mac_address, station in ambient.stations.items()
|
||||||
for mac_address, station in ambient.stations.items()
|
for description in SENSOR_DESCRIPTIONS
|
||||||
for description in SENSOR_DESCRIPTIONS
|
if description.key in station[ATTR_LAST_DATA]
|
||||||
if description.key in station[ATTR_LAST_DATA]
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user