def setBoiler(request):
    caldera = Boiler()
    try:
        if request.POST["state"] == "on":
            content = caldera.turnOn()
        elif request.POST["state"] == "off":
            content = caldera.turnOff()
        else:
            content = {"state": "Format not recognized"}
    except MultiValueDictKeyError:
        content = {"state": request}
    return Response(content)
Exemple #2
0
def setBoiler(request):
    caldera = Boiler()
    try:
        if request.POST['state'] == 'on':
            content = caldera.turnOn()
        elif request.POST['state'] == 'off':
            content = caldera.turnOff()
        else:
            content = {'state': 'Format not recognized'}
    except MultiValueDictKeyError:
        content = {'state': request}
    return Response(content)
def turnOff(request):
    caldera = Boiler()
    content = caldera.turnOff()
    return Response(content)
def check(request):
    caldera = Boiler()
    content = caldera.getState()
    return Response(content)
Exemple #5
0
def turnOff(request):
    caldera = Boiler()
    content = caldera.turnOff()
    return Response(content)
Exemple #6
0
def check(request):
    caldera = Boiler()
    content = caldera.getState()
    return Response(content)