use a generator expression

This commit is contained in:
Jon Maddox
2018-03-08 10:14:45 -05:00
parent 02476cfe28
commit 130721e8e3

View File

@@ -72,8 +72,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
"""Handler for services.""" """Handler for services."""
entity_id = service.data.get(ATTR_ENTITY_ID) entity_id = service.data.get(ATTR_ENTITY_ID)
device = next([device for device in hass.data[DATA_CHANNELS] if device = next((device for device in hass.data[DATA_CHANNELS] if
device.entity_id == entity_id].__iter__(), None) device.entity_id == entity_id), None)
if device is None: if device is None:
_LOGGER.warning("Unable to find Channels with entity_id: %s", _LOGGER.warning("Unable to find Channels with entity_id: %s",