From b025d6c6f271212a3e7bf08f3999ad3e8487ed64 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Tue, 5 Mar 2024 21:10:02 +0100 Subject: [PATCH] Remove list comprehension when adding entities in Smartthings (#112432) --- homeassistant/components/smartthings/fan.py | 8 +++----- homeassistant/components/smartthings/lock.py | 8 +++----- homeassistant/components/smartthings/scene.py | 2 +- homeassistant/components/smartthings/switch.py | 8 +++----- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/smartthings/fan.py b/homeassistant/components/smartthings/fan.py index 0e15ea7800a..37c19eecd6b 100644 --- a/homeassistant/components/smartthings/fan.py +++ b/homeassistant/components/smartthings/fan.py @@ -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") ) diff --git a/homeassistant/components/smartthings/lock.py b/homeassistant/components/smartthings/lock.py index c0fbc32fa19..4e726ddc991 100644 --- a/homeassistant/components/smartthings/lock.py +++ b/homeassistant/components/smartthings/lock.py @@ -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") ) diff --git a/homeassistant/components/smartthings/scene.py b/homeassistant/components/smartthings/scene.py index ffdb900237e..faf58ede014 100644 --- a/homeassistant/components/smartthings/scene.py +++ b/homeassistant/components/smartthings/scene.py @@ -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): diff --git a/homeassistant/components/smartthings/switch.py b/homeassistant/components/smartthings/switch.py index e6432dcb50c..b1a859847a3 100644 --- a/homeassistant/components/smartthings/switch.py +++ b/homeassistant/components/smartthings/switch.py @@ -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") )