Пример #1
0
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)
Пример #2
0
def status():
    return make_ws_response(getDeviceStatus(), 0)