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)
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)
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)
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)
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