def start_pairing(self, timeout): """ Start the pairing process. timeout -- Timeout in seconds at which to quit pairing """ if self.username is None or self.password is None: return self.pairing = True for dev in lakeside.get_devices(self.username, self.password): if not self.pairing: break _id = 'eufy-' + dev['id'] if _id not in self.devices: address = dev['address'] code = dev['code'] model = dev['type'] name = dev['name'] if model in ['T1201', 'T1202', 'T1211']: eufy_dev = lakeside.switch(address, code, model) device = EufySwitch(self, _id, name, eufy_dev) elif model in ['T1011', 'T1012', 'T1013']: eufy_dev = lakeside.bulb(address, code, model) device = EufyBulb(self, _id, name, eufy_dev) else: continue self.handle_device_added(device)
def __init__(self, device): """Initialize the light.""" self._state = None self._name = device["name"] self._address = device["address"] self._code = device["code"] self._type = device["type"] self._switch = lakeside.switch(self._address, self._code, self._type) self._switch.connect()
def __init__(self, device): """Initialize the light.""" import lakeside self._state = None self._name = device['name'] self._address = device['address'] self._code = device['code'] self._type = device['type'] self._switch = lakeside.switch(self._address, self._code, self._type) self._switch.connect()
username = '******' password = '******' devices = lakeside.get_devices(username, password) bulb = lakeside.bulb(devices[1]['address'], devices[1]['code'], devices[1]['type']) bulb.connect() brightness = 50 for i in range(25): bulb.set_state(power=True, brightness=brightness, temperature=i * 4) time.sleep(0.25) for i in range(2): bulb.set_state(power=True) time.sleep(1) bulb.set_state(power=False) time.sleep(1) switch = lakeside.switch(devices[4]['address'], devices[4]['code'], devices[4]['type']) switch.connect() for i in range(2): switch.set_state(power=True) time.sleep(1) switch.set_state(power=False) time.sleep(1)