Allow qwikswitch sensors as part of devices (#14454)

This commit is contained in:
Johann Kellerman 2018-05-14 08:40:25 +02:00 committed by Sebastian Muszynski
parent 8ae3caa292
commit 6b9c65c9ce

View File

@ -150,8 +150,10 @@ async def async_setup(hass, config):
comps = {'switch': [], 'light': [], 'sensor': [], 'binary_sensor': []}
try:
sensor_ids = []
for sens in sensors:
_, _type = SENSORS[sens['type']]
sensor_ids.append(sens['id'])
if _type is bool:
comps['binary_sensor'].append(sens)
continue
@ -192,9 +194,7 @@ async def async_setup(hass, config):
'qwikswitch.button.{}'.format(qspacket[QS_ID]), qspacket)
return
if qspacket[QS_ID] not in qsusb.devices:
# Not a standard device in, component can handle packet
# i.e. sensors
if qspacket[QS_ID] in sensor_ids:
_LOGGER.debug("Dispatch %s ((%s))", qspacket[QS_ID], qspacket)
hass.helpers.dispatcher.async_dispatcher_send(
qspacket[QS_ID], qspacket)