diff --git a/homeassistant/components/abode/binary_sensor.py b/homeassistant/components/abode/binary_sensor.py index 58bb101cb5d..4f7af8af640 100644 --- a/homeassistant/components/abode/binary_sensor.py +++ b/homeassistant/components/abode/binary_sensor.py @@ -30,12 +30,10 @@ async def async_setup_entry( CONST.TYPE_OPENING, ] - entities = [] - - for device in data.abode.get_devices(generic_type=device_types): - entities.append(AbodeBinarySensor(data, device)) - - async_add_entities(entities) + async_add_entities( + AbodeBinarySensor(data, device) + for device in data.abode.get_devices(generic_type=device_types) + ) class AbodeBinarySensor(AbodeDevice, BinarySensorEntity): diff --git a/homeassistant/components/abode/camera.py b/homeassistant/components/abode/camera.py index 9885ccb54ef..d0f428a45fa 100644 --- a/homeassistant/components/abode/camera.py +++ b/homeassistant/components/abode/camera.py @@ -28,12 +28,11 @@ async def async_setup_entry( ) -> None: """Set up Abode camera devices.""" data: AbodeSystem = hass.data[DOMAIN] - entities = [] - for device in data.abode.get_devices(generic_type=CONST.TYPE_CAMERA): - entities.append(AbodeCamera(data, device, TIMELINE.CAPTURE_IMAGE)) - - async_add_entities(entities) + async_add_entities( + AbodeCamera(data, device, TIMELINE.CAPTURE_IMAGE) + for device in data.abode.get_devices(generic_type=CONST.TYPE_CAMERA) + ) class AbodeCamera(AbodeDevice, Camera): diff --git a/homeassistant/components/abode/cover.py b/homeassistant/components/abode/cover.py index 7943056f8ac..b48f00209ec 100644 --- a/homeassistant/components/abode/cover.py +++ b/homeassistant/components/abode/cover.py @@ -19,12 +19,10 @@ async def async_setup_entry( """Set up Abode cover devices.""" data: AbodeSystem = hass.data[DOMAIN] - entities = [] - - for device in data.abode.get_devices(generic_type=CONST.TYPE_COVER): - entities.append(AbodeCover(data, device)) - - async_add_entities(entities) + async_add_entities( + AbodeCover(data, device) + for device in data.abode.get_devices(generic_type=CONST.TYPE_COVER) + ) class AbodeCover(AbodeDevice, CoverEntity): diff --git a/homeassistant/components/abode/light.py b/homeassistant/components/abode/light.py index 1bb9d41f461..030e5744ce8 100644 --- a/homeassistant/components/abode/light.py +++ b/homeassistant/components/abode/light.py @@ -32,12 +32,10 @@ async def async_setup_entry( """Set up Abode light devices.""" data: AbodeSystem = hass.data[DOMAIN] - entities = [] - - for device in data.abode.get_devices(generic_type=CONST.TYPE_LIGHT): - entities.append(AbodeLight(data, device)) - - async_add_entities(entities) + async_add_entities( + AbodeLight(data, device) + for device in data.abode.get_devices(generic_type=CONST.TYPE_LIGHT) + ) class AbodeLight(AbodeDevice, LightEntity): diff --git a/homeassistant/components/abode/lock.py b/homeassistant/components/abode/lock.py index 368769003b0..12258a45aaf 100644 --- a/homeassistant/components/abode/lock.py +++ b/homeassistant/components/abode/lock.py @@ -19,12 +19,10 @@ async def async_setup_entry( """Set up Abode lock devices.""" data: AbodeSystem = hass.data[DOMAIN] - entities = [] - - for device in data.abode.get_devices(generic_type=CONST.TYPE_LOCK): - entities.append(AbodeLock(data, device)) - - async_add_entities(entities) + async_add_entities( + AbodeLock(data, device) + for device in data.abode.get_devices(generic_type=CONST.TYPE_LOCK) + ) class AbodeLock(AbodeDevice, LockEntity): diff --git a/homeassistant/components/abode/sensor.py b/homeassistant/components/abode/sensor.py index 2564b775cf9..da854153293 100644 --- a/homeassistant/components/abode/sensor.py +++ b/homeassistant/components/abode/sensor.py @@ -42,19 +42,12 @@ async def async_setup_entry( """Set up Abode sensor devices.""" data: AbodeSystem = hass.data[DOMAIN] - entities = [] - - for device in data.abode.get_devices(generic_type=CONST.TYPE_SENSOR): - conditions = device.get_value(CONST.STATUSES_KEY) - entities.extend( - [ - AbodeSensor(data, device, description) - for description in SENSOR_TYPES - if description.key in conditions - ] - ) - - async_add_entities(entities) + async_add_entities( + AbodeSensor(data, device, description) + for description in SENSOR_TYPES + for device in data.abode.get_devices(generic_type=CONST.TYPE_SENSOR) + if description.key in device.get_value(CONST.STATUSES_KEY) + ) class AbodeSensor(AbodeDevice, SensorEntity): diff --git a/homeassistant/components/abode/switch.py b/homeassistant/components/abode/switch.py index 5ed32b4f83c..f472a5028c0 100644 --- a/homeassistant/components/abode/switch.py +++ b/homeassistant/components/abode/switch.py @@ -25,14 +25,16 @@ async def async_setup_entry( """Set up Abode switch devices.""" data: AbodeSystem = hass.data[DOMAIN] - entities: list[SwitchEntity] = [] + entities: list[SwitchEntity] = [ + AbodeSwitch(data, device) + for device_type in DEVICE_TYPES + for device in data.abode.get_devices(generic_type=device_type) + ] - for device_type in DEVICE_TYPES: - for device in data.abode.get_devices(generic_type=device_type): - entities.append(AbodeSwitch(data, device)) - - for automation in data.abode.get_automations(): - entities.append(AbodeAutomationSwitch(data, automation)) + entities.extend( + AbodeAutomationSwitch(data, automation) + for automation in data.abode.get_automations() + ) async_add_entities(entities)