1 """Common utilities for VeSync Component."""
5 from .const
import VS_FANS, VS_LIGHTS, VS_SENSORS, VS_SWITCHES
7 _LOGGER = logging.getLogger(__name__)
11 """Assign devices to proper component."""
13 devices[VS_SWITCHES] = []
15 devices[VS_LIGHTS] = []
16 devices[VS_SENSORS] = []
18 await hass.async_add_executor_job(manager.update)
21 devices[VS_FANS].extend(manager.fans)
23 devices[VS_SENSORS].extend(manager.fans)
24 _LOGGER.debug(
"%d VeSync fans found", len(manager.fans))
27 devices[VS_LIGHTS].extend(manager.bulbs)
28 _LOGGER.debug(
"%d VeSync lights found", len(manager.bulbs))
31 devices[VS_SWITCHES].extend(manager.outlets)
33 devices[VS_SENSORS].extend(manager.outlets)
34 _LOGGER.debug(
"%d VeSync outlets found", len(manager.outlets))
37 for switch
in manager.switches:
38 if not switch.is_dimmable():
39 devices[VS_SWITCHES].append(switch)
41 devices[VS_LIGHTS].append(switch)
42 _LOGGER.debug(
"%d VeSync switches found", len(manager.switches))
def async_process_devices(hass, manager)