mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +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,25 +31,26 @@ 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,
|
(await dt_util.async_get_time_zone(thermostat["location"]["timeZone"]))
|
||||||
(await dt_util.async_get_time_zone(thermostat["location"]["timeZone"]))
|
or dt_util.get_default_time_zone(),
|
||||||
or dt_util.get_default_time_zone(),
|
)
|
||||||
)
|
for index, thermostat in enumerate(data.ecobee.thermostats)
|
||||||
|
if thermostat["settings"]["ventilatorType"] != "none"
|
||||||
|
]
|
||||||
|
|
||||||
|
entities.extend(
|
||||||
|
(
|
||||||
|
EcobeeSwitchAuxHeatOnly(data, index)
|
||||||
for index, thermostat in enumerate(data.ecobee.thermostats)
|
for index, thermostat in enumerate(data.ecobee.thermostats)
|
||||||
if thermostat["settings"]["ventilatorType"] != "none"
|
if thermostat["settings"]["hasHeatPump"]
|
||||||
],
|
)
|
||||||
update_before_add=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
async_add_entities(
|
async_add_entities(entities, update_before_add=True)
|
||||||
EcobeeSwitchAuxHeatOnly(data, index)
|
|
||||||
for index, thermostat in enumerate(data.ecobee.thermostats)
|
|
||||||
if thermostat["settings"]["hasHeatPump"]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class EcobeeVentilator20MinSwitch(EcobeeBaseEntity, SwitchEntity):
|
class EcobeeVentilator20MinSwitch(EcobeeBaseEntity, SwitchEntity):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user