def get_relais(relay=None): if relay is None: response = [] for relay, status in enumerate(relays_proxy.get_relays()): response.append(relay_result(relay, status)) else: response = relay_result(relay, relais_proxy.get_relay(relay)) return jsonify(payload=response)
def reset_relais(relay): if check_permission(relay): relays_proxy.set_relay(relay, False) else: return auth_required() return jsonify(payload=relay_result(relay, False))