def turn_room_lights(room_id): # return JSON of just the given room c = Connection() json_data = request.get_json() hue_response = c.put(f'/groups/{room_id}/action', json_data) return jsonify(hue_response, HTTPStatus.OK)
def set_light_state(light_id): # turn a single line off and on c = Connection() json_data = request.get_json() hue_response = c.put(f'/lights/{light_id}/state', json_data) return jsonify(hue_response, HTTPStatus.OK)
def get_light_state(light_id): # turn a single line off and on c = Connection() hue_response = c.get(f'/lights/{light_id}') print(hue_response) return jsonify(hue_response, HTTPStatus.OK)
def get_state(room_id): c = Connection() group = c.get('/groups/1') group_state = group['state'] return jsonify(group_state)
def main(): # Connection and Group connection = Connection(verify=False) groups = connection.get_all_groups() print(f"All groups {groups.keys()}") # for group in groups.items(): # print("group", group) g1 = Group(1, connection) g1.turn_on(False) # g1.set_effect(False) g1.set_bri(150)
def get_single_room(room_id): # return JSON of just the given room c = Connection() return jsonify(c.get(f'/groups/{room_id}'))
def get_rooms(): # return JSON of all the rooms c = Connection() return jsonify(c.get('/groups'))