def install_lifx(self, args={}): from core.firefly_api import install_child_device lightData = self.getLights() for light, data in lightData['lights'].iteritems(): data['bridgeID'] = self._id data['args'] = data data['args']['name'] = data.get('label') newLight = lightDevice.Device(light, data) lData = {} lData['name'] = data.get('label') lData['args'] = {'name':data.get('label')} install_child_device(light, newLight, config=lData)
def install_lifx(self, args={}): from core.firefly_api import install_child_device lightData = self.getLights() for light, data in lightData['lights'].iteritems(): data['bridgeID'] = self._id data['args'] = data data['args']['name'] = data.get('label') newLight = lightDevice.Device(light, data) lData = {} lData['name'] = data.get('label') lData['args'] = {'name': data.get('label')} install_child_device(light, newLight, config=lData)
def install_devices(self): ''' Installs all supported devices from indigo. Each device name will be: indigo-{{NAME}} ''' # TODO Updated this to the enw install_child function from core.firefly_api import install_child_device for name, device in self.get_devices().iteritems(): logging.info('Installing child device %s' % name) if device.get('typeSupportsOnOff') and not device.get( 'typeIsSensor') and not device.get('typeIsDimmer'): logging.info('SUPPORTED DEVICE') config = {'args': device} new_switch = indigoSwitch(name, args=config) install_child_device(name, new_switch, config=config) else: logging.error('UNSUPPORTED DEVICE %s' % name)
def install_hue(self): from core.firefly_api import install_child_device logging.debug("Installing Hue Bridge") self._hueBridge = bridge.Bridge(deviceID='ffHueBridge', username=self._username) install_child_device('ffHueBridge',self._hueBridge) rawLightData = self._hueBridge.get_lights() for light, lightData in rawLightData.iteritems(): lightData['bridgeID'] = 'ffHueBridge' lightConfig = {} lightConfig['args'] = lightData lightConfig['args']['lightID'] = light newLight = lightDevice.Device('hue-light-' + str(light), lightConfig) lightData['args'] = {} lightData['args']['name'] = lightData.get('name') install_child_device('hue-light-' + str(light), newLight, config=lightData) rawGroupData = self._hueBridge.get_groups() for group, groupData in rawGroupData.iteritems(): groupData['bridgeID'] = 'ffHueBridge' groupConfig = {} groupConfig['args'] = groupData groupConfig['args']['groupID'] = group newGroup = groupDevice.Device('hue-group-' + str(group), groupConfig) groupData['args'] = {} groupData['args']['name'] = groupData.get('name') install_child_device('hue-group-' + str(group), newGroup, config=groupData) self.refresh_scheduler()