Simplify setup of tradfri entities (#59343)
* Simplify detection of devices.
This commit is contained in:
parent
5177fabee0
commit
ad91e4b417
5 changed files with 25 additions and 27 deletions
|
@ -27,17 +27,17 @@ async def async_setup_entry(
|
|||
api = tradfri_data[KEY_API]
|
||||
devices = tradfri_data[DEVICES]
|
||||
|
||||
sensors = (
|
||||
dev
|
||||
async_add_entities(
|
||||
TradfriSensor(dev, api, gateway_id)
|
||||
for dev in devices
|
||||
if not dev.has_light_control
|
||||
and not dev.has_socket_control
|
||||
and not dev.has_blind_control
|
||||
and not dev.has_signal_repeater_control
|
||||
and not dev.has_air_purifier_control
|
||||
if (
|
||||
not dev.has_light_control
|
||||
and not dev.has_socket_control
|
||||
and not dev.has_blind_control
|
||||
and not dev.has_signal_repeater_control
|
||||
and not dev.has_air_purifier_control
|
||||
)
|
||||
)
|
||||
if sensors:
|
||||
async_add_entities(TradfriSensor(sensor, api, gateway_id) for sensor in sensors)
|
||||
|
||||
|
||||
class TradfriSensor(TradfriBaseDevice, SensorEntity):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue