mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +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."""
|
||||
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
||||
async_add_entities(
|
||||
[
|
||||
SmartThingsFan(device)
|
||||
for device in broker.devices.values()
|
||||
if broker.any_assigned(device.device_id, "fan")
|
||||
]
|
||||
SmartThingsFan(device)
|
||||
for device in broker.devices.values()
|
||||
if broker.any_assigned(device.device_id, "fan")
|
||||
)
|
||||
|
||||
|
||||
|
@ -33,11 +33,9 @@ async def async_setup_entry(
|
||||
"""Add locks for a config entry."""
|
||||
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
||||
async_add_entities(
|
||||
[
|
||||
SmartThingsLock(device)
|
||||
for device in broker.devices.values()
|
||||
if broker.any_assigned(device.device_id, "lock")
|
||||
]
|
||||
SmartThingsLock(device)
|
||||
for device in broker.devices.values()
|
||||
if broker.any_assigned(device.device_id, "lock")
|
||||
)
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Add switches for a config entry."""
|
||||
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):
|
||||
|
@ -23,11 +23,9 @@ async def async_setup_entry(
|
||||
"""Add switches for a config entry."""
|
||||
broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id]
|
||||
async_add_entities(
|
||||
[
|
||||
SmartThingsSwitch(device)
|
||||
for device in broker.devices.values()
|
||||
if broker.any_assigned(device.device_id, "switch")
|
||||
]
|
||||
SmartThingsSwitch(device)
|
||||
for device in broker.devices.values()
|
||||
if broker.any_assigned(device.device_id, "switch")
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user