def set_group(self, group_id, state):
    url = '{}/groups/{}/action'.format(self.base_url, group_id)
    try:
        r = requests.put(url, data=json.dumps({'on': state}))
    except:
        raise APIException('Failed to send group set PUT')
def set_group(self, group_id, state):
    url = '{}/groups/{}/action'.format(self.base_url, group_id)
    try:
        r = requests.put(url, data=json.dumps({'on': state}))
    except:
        raise APIException('Failed to send group set PUT')