_TYPE_DOOR = 'door' _TYPE_GARAGE_DOOR = 'garage_door' _TYPE_MOISTURE = 'moisture' _TYPE_OPENING = 'opening' _TYPE_WINDOW = 'window' _TYPE_LIGHT = 'light' _TYPE_MOTION = 'motion' _TYPE_BATTERY = 'battery' _TYPE_REMOTE = 'remote' _TYPES = [_TYPE_MOTION, _TYPE_BATTERY, _TYPE_DOOR, _TYPE_GARAGE_DOOR, _TYPE_MOISTURE, _TYPE_OPENING, _TYPE_WINDOW, _TYPE_LIGHT, _TYPE_REMOTE] PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_TYPE, default=_TYPE_OPENING): vol.In(_TYPES), vol.Required(CONF_NAME): cv.string, vol.Required(CONF_CHANNEL): cv.positive_int, }) _DATA_INTERVAL = 13 * 60 * 60 _BATTERY_DATA_INTERVAL = 6 * 60 * 60 def setup_platform(hass, config, add_devices, discovery_info=None): """Setup the NooLite platform.""" _LOGGER.info(config) module_type = config[CONF_TYPE].lower() devices = [] if module_type == _TYPE_MOTION:
DEPENDENCIES = ['noolite'] _LOGGER = logging.getLogger(__name__) _SCAN_INTERVAL = timedelta(seconds=60) _TYPE_LIGHT = 'light' _TYPE_DIMMER = 'dimmer' _TYPE_RGB_LED = 'rgb_led' _TYPES = [_TYPE_LIGHT, _TYPE_DIMMER, _TYPE_RGB_LED] PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_TYPE, default=_TYPE_LIGHT): vol.In(_TYPES), vol.Optional(CONF_BROADCAST, default=False): cv.boolean, vol.Optional(CONF_SCAN_INTERVAL, default=_SCAN_INTERVAL): cv.time_period, vol.Required(CONF_NAME): cv.string, vol.Required(CONF_CHANNEL): cv.positive_int, vol.Required(CONF_MODE, default=MODE_NOOLITE_F): vol.In(MODES_NOOLITE), }) def setup_platform(hass, config, add_devices, discovery_info=None): """Setup the NooLite platform.""" _LOGGER.info(config) module_type = config[CONF_TYPE].lower() devices = [] if module_type == _TYPE_LIGHT: devices.append(NooLiteSwitch(config, hass.data[DOMAIN])) elif module_type == _TYPE_DIMMER:
_TYPE_TEMP = 'temp' _TYPE_HUMI = 'humi' _TYPE_ANALOG = 'analog' _TYPE_REMOTE = 'remote' _TYPES = [_TYPE_HUMI, _TYPE_TEMP, _TYPE_ANALOG, _TYPE_REMOTE] _DATA_INTERVAL = 1.5 * 60 * 60 _BATTERY_DATA_INTERVAL = 6 * 60 * 60 MEASUREMENT_PERCENTS = "%" PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_TYPE): vol.In(_TYPES), vol.Required(CONF_NAME): cv.string, vol.Required(CONF_CHANNEL): cv.positive_int }) def setup_platform(hass, config, add_devices, discovery_info=None): """Setup the NooLite platform.""" _LOGGER.info(config) module_type = config[CONF_TYPE].lower() devices = [] if module_type == _TYPE_HUMI: devices.append(NooLiteHumiditySensor(config, hass.data[DOMAIN])) elif module_type == _TYPE_TEMP: devices.append(NooLiteTemperatureSensor(config, hass.data[DOMAIN]))