def requestHandler_fog_off(get):
    try:
        turnOffRelay(relay_fogmachine)

    except:
        return "text/plain", traceback.write_exc()
    else:
        return "text/plain", "ok"
def requestHandler_all_strobes_off(get):
    try:
        turnOffRelay(relay_raidlight)
        turnOffRelay(relay_redlight)
        turnOffRelay(relay_yellowlight)
        turnOffRelay(relay_bluelight)

    except:
        return "text/plain", traceback.write_exc()
    else:
        return "text/plain", "ok"
def requestHandler_scene_farewell(get):
    try:
        xr18.send_message("/ch/01/mix/fader", [0.0])
        xr18.send_message("/ch/03/mix/fader", [0.75])
        xr18.send_message("/ch/10/mix/fader", [0.0])
        xr18.send_message("/ch/13/mix/fader", [0.0])

    except:
        return "text/plain", traceback.write_exc()
    else:
        return "text/plain", "ok"
def requestHandler_notspookymode(get):
    global clients, xr18

    try:

        xr18.send_message("/fx/1/insert", [0.0])
        xr18.send_message("/rtn/2/mix/fader", [0.0])
        xr18.send_message("/rtn/3/mix/fader", [0.0])
        xr18.send_message("/rtn/4/mix/fader", [0.0])
        # requests.get("http://10.0.0.44:8081/preset/nms")

    except:
        return "text/plain", traceback.write_exc()
    else:
        return "text/plain", "ok"
def requestHandler_resetDogCounter(get):
    """Reset red and blue dog counter to zero."""
    global clients, count

    count = {"red": 0, "blue": 0}

    try:

        json.dump(count, open("count.json", "wb"))

        for client in clients:
            client.write_message(json.dumps({"messagetype": "dogbutton", "count": count}))

    except:
        return "text/plain", traceback.write_exc()
    else:
        return "text/plain", "ok"