def addLight(self,light):
     'type light: LimitlessLight'
     utils.log_verbose("LimitlessScene.addLight: " + str(light))
     if (light):
         lighttype= light.type
         lightid  = light.groupid
         bridge   = light.bridge
         if bridge not in self.lightGroups:
             self.lightGroups[bridge] = {lightid:light}
         #self.lightGroups.update({bridge:{lightid:light}})
         self.lightGroups[bridge][lightid] = light
 def applyScene(self,scene):
     # get our bridge elements from the scenes lightGroups
     lights = scene.getLights(self)
     utils.log_verbose(scene.name + " # LightGroups: " + str(len(lights)))
     for light in lights:
         animate=scene.animate
         reference = self.state[light.groupid]
         if reference is None:
                 animate=0
         utils.log_verbose("Lighting: " + str(light))
         self.light_scene(light,scene.animate,reference,scene.animateBrightness)
         self.state[light.groupid] = light.clone()
     return
Example #3
0
    def send_command(self, cmd, data=False, **params):
        url = self._cmd_url_fmt.format(cmd)
        if params:
            url += "&" + urllib.urlencode(params)

        utils.log_verbose(url)
        try:
            response = requests.get(url)
        except (requests.RequestException) as e:
            utils.log_error(str(e))
            return False
        else:
            if not response:
                return False
            elif data:
                return response.content
            else:
                utils.log_verbose(response)
                xml_resp = CameraXMLResponse(response)
                utils.log_verbose(xml_resp)
                if not xml_resp:
                    utils.log_error(xml_resp.message)
                return xml_resp