def device_action(deviceType): ## Authorization authorize(request.headers, "device", deviceType) data = json.loads(request.data) action = data["action"] if action == "OFF": stopDevice(deviceType) elif action == "ON": startDevice(deviceType) else: return make_ws_response({"error": "Invalid Action"}, 1) return make_ws_response(data, 0)
def status(): return make_ws_response(getDeviceStatus(), 0)