Remove list comprehension when adding entities in Smartthings (#112432)

This commit is contained in:
Jan-Philipp Benecke 2024-03-05 21:10:02 +01:00 committed by GitHub
parent 9a24e97ecb
commit b025d6c6f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 16 deletions

View File

@ -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")
)

View File

@ -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")
)

View File

@ -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):

View File

@ -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")
)