Esempio n. 1
0
    def _scene_control(self, scene_id, action):
        cmd = "sceneControl"
        params = {"id": scene_id, "action": action}
        resp = self.http_client.get(cmd, params=params)
        if resp.status_code != 202:
            exceptions.from_response(resp)

        return self.get(scene_id)
Esempio n. 2
0
    def action(self, device_id, action, *args):
        cmd = "callAction?deviceID={0}&name={1}".format(device_id, action)
        for i, arg in enumerate(args, 1):
            cmd = '{0}&arg{1}={2}'.format(cmd, i, arg)

        resp = self.http_client.get(cmd)
        if resp.status_code != 200 and resp.status_code != 202:
            exceptions.from_response(resp)
Esempio n. 3
0
    def action(self, device_id, action, *args):
        cmd = "/callAction?deviceID={0}&name={1}".format(device_id, action)
        for i, arg in enumerate(args, 1):
            cmd = '{0}&arg{1}={2}'.format(cmd, i, arg)

        resp = self.http_client.get(cmd)
        if resp.status_code != 200 and resp.status_code != 202:
            exceptions.from_response(resp)
Esempio n. 4
0
    def _scene_control(self, scene_id, action):
        cmd = "sceneControl"
        params = {
            "id": scene_id,
            "action": action
        }
        resp = self.http_client.get(cmd, params=params)
        if resp.status_code != 202:
            exceptions.from_response(resp)

        return self.get(scene_id)
Esempio n. 5
0
 def _error_handler(self, response):
     if response.status_code < 200 or response.status_code > 300:
         self.logger.debug(
             "ERROR: %s",
             response.text,
         )
         raise exceptions.from_response(response)
     return response
Esempio n. 6
0
 def _error_handler(self, response):
     if response.status_code < 200 or response.status_code > 300:
         self.logger.debug(
             "ERROR: %s",
             response.text,
         )
         raise exceptions.from_response(response)
     return response