def group_switch_power(group_name): def action(): group = Group(LAN, group_name) group.switch_power() return {"success": True} return flask_utils.wrapper(action)
def group_set_power(group_name, value): def action(): group = Group(LAN, group_name) data = flask_utils.get_data(request.data) group.set_power(value, duration=data["duration"], wait=data["wait"]) return {"success": True} return flask_utils.wrapper(action)
def group_get_power(group_name): def action(): group = Group(LAN, group_name) return {"power": group.get_power()} return flask_utils.wrapper(action)
def group_get_devices(group_name): def action(): group = Group(LAN, group_name) return {"devices": group.get_devices_label()} return flask_utils.wrapper(action)
def groups_stats(): def action(): return {"groups": Group.stats_group(LAN)} return flask_utils.wrapper(action)
def groups_list(): def action(): return {"groups": Group.list_group(LAN)} return flask_utils.wrapper(action)
def devices_list(): def action(): devices = [d.get_label() for d in LAN.get_devices()] return {"devices": devices} return flask_utils.wrapper(action)
def hello(): def action(): return "Hey! Listen" return flask_utils.wrapper(action)
def group_get_infrared(group_name): def action(): group = Group(LAN, group_name) return {"infrared": group.get_infrared()} return flask_utils.wrapper(action)
def group_get_colortemp(group_name): def action(): group = Group(LAN, group_name) return {"colortemp": group.get_colortemp()} return flask_utils.wrapper(action)
def group_get_brightness(group_name): def action(): group = Group(LAN, group_name) return {"brightness": group.get_brightness()} return flask_utils.wrapper(action)
def group_get_saturation(group_name): def action(): group = Group(LAN, group_name) return {"saturation": group.get_saturation()} return flask_utils.wrapper(action)
def group_get_hue(group_name): def action(): group = Group(LAN, group_name) return {"hue": group.get_hue()} return flask_utils.wrapper(action)