mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Remove list comprehension when adding entities in Smartthings (#112432)
This commit is contained in:
parent
9a24e97ecb
commit
b025d6c6f2
@ -31,11 +31,9 @@ async def async_setup_entry(
|
|||||||
"""Add fans for a config entry."""
|
"""Add fans for a config entry."""
|
||||||
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
[
|
SmartThingsFan(device)
|
||||||
SmartThingsFan(device)
|
for device in broker.devices.values()
|
||||||
for device in broker.devices.values()
|
if broker.any_assigned(device.device_id, "fan")
|
||||||
if broker.any_assigned(device.device_id, "fan")
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,11 +33,9 @@ async def async_setup_entry(
|
|||||||
"""Add locks for a config entry."""
|
"""Add locks for a config entry."""
|
||||||
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
[
|
SmartThingsLock(device)
|
||||||
SmartThingsLock(device)
|
for device in broker.devices.values()
|
||||||
for device in broker.devices.values()
|
if broker.any_assigned(device.device_id, "lock")
|
||||||
if broker.any_assigned(device.device_id, "lock")
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ async def async_setup_entry(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Add switches for a config entry."""
|
"""Add switches for a config entry."""
|
||||||
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
||||||
async_add_entities([SmartThingsScene(scene) for scene in broker.scenes.values()])
|
async_add_entities(SmartThingsScene(scene) for scene in broker.scenes.values())
|
||||||
|
|
||||||
|
|
||||||
class SmartThingsScene(Scene):
|
class SmartThingsScene(Scene):
|
||||||
|
@ -23,11 +23,9 @@ async def async_setup_entry(
|
|||||||
"""Add switches for a config entry."""
|
"""Add switches for a config entry."""
|
||||||
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
[
|
SmartThingsSwitch(device)
|
||||||
SmartThingsSwitch(device)
|
for device in broker.devices.values()
|
||||||
for device in broker.devices.values()
|
if broker.any_assigned(device.device_id, "switch")
|
||||||
if broker.any_assigned(device.device_id, "switch")
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user