mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Consolidating async_add_entities into one call in Ecobee (#129917)
* Consolidating async_add_entities into one call. * changing to comprehension.
This commit is contained in:
parent
184cbfea23
commit
2eb2bdd615
@ -31,8 +31,7 @@ async def async_setup_entry(
|
|||||||
"""Set up the ecobee thermostat switch entity."""
|
"""Set up the ecobee thermostat switch entity."""
|
||||||
data: EcobeeData = hass.data[DOMAIN]
|
data: EcobeeData = hass.data[DOMAIN]
|
||||||
|
|
||||||
async_add_entities(
|
entities: list[SwitchEntity] = [
|
||||||
[
|
|
||||||
EcobeeVentilator20MinSwitch(
|
EcobeeVentilator20MinSwitch(
|
||||||
data,
|
data,
|
||||||
index,
|
index,
|
||||||
@ -41,15 +40,17 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
for index, thermostat in enumerate(data.ecobee.thermostats)
|
for index, thermostat in enumerate(data.ecobee.thermostats)
|
||||||
if thermostat["settings"]["ventilatorType"] != "none"
|
if thermostat["settings"]["ventilatorType"] != "none"
|
||||||
],
|
]
|
||||||
update_before_add=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
async_add_entities(
|
entities.extend(
|
||||||
|
(
|
||||||
EcobeeSwitchAuxHeatOnly(data, index)
|
EcobeeSwitchAuxHeatOnly(data, index)
|
||||||
for index, thermostat in enumerate(data.ecobee.thermostats)
|
for index, thermostat in enumerate(data.ecobee.thermostats)
|
||||||
if thermostat["settings"]["hasHeatPump"]
|
if thermostat["settings"]["hasHeatPump"]
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
async_add_entities(entities, update_before_add=True)
|
||||||
|
|
||||||
|
|
||||||
class EcobeeVentilator20MinSwitch(EcobeeBaseEntity, SwitchEntity):
|
class EcobeeVentilator20MinSwitch(EcobeeBaseEntity, SwitchEntity):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user