|
|
|
@ -30,21 +30,23 @@ def add_latest_reading(meter, info):
|
|
|
|
|
return make_response("Meter Id. not recognised. Must be between 1 and 3.", 400) |
|
|
|
|
return make_response("Invalid token.", 400) |
|
|
|
|
|
|
|
|
|
def log_status_change(device, status): |
|
|
|
|
# NEED TO ADD TOKEN. |
|
|
|
|
if device == 1: |
|
|
|
|
return add_status_change_to_device1(status) |
|
|
|
|
elif device == 2: |
|
|
|
|
return add_status_change_to_device2(status) |
|
|
|
|
elif device == 3: |
|
|
|
|
return add_status_change_to_device3(status) |
|
|
|
|
elif device == 4: |
|
|
|
|
return add_status_change_to_device4(status) |
|
|
|
|
elif device == 5: |
|
|
|
|
return add_status_change_to_device5(status) |
|
|
|
|
elif device == 6: |
|
|
|
|
return add_status_change_to_device6(status) |
|
|
|
|
return make_response("Device Id. not recognised. Must be between 1 and 6.", 400) |
|
|
|
|
def log_status_change(device, info): |
|
|
|
|
if info["token"] == device_check_token: |
|
|
|
|
status = {"time":info["time"], "status":info["status"]} |
|
|
|
|
if device == 1: |
|
|
|
|
return add_status_change_to_device1(status) |
|
|
|
|
elif device == 2: |
|
|
|
|
return add_status_change_to_device2(status) |
|
|
|
|
elif device == 3: |
|
|
|
|
return add_status_change_to_device3(status) |
|
|
|
|
elif device == 4: |
|
|
|
|
return add_status_change_to_device4(status) |
|
|
|
|
elif device == 5: |
|
|
|
|
return add_status_change_to_device5(status) |
|
|
|
|
elif device == 6: |
|
|
|
|
return add_status_change_to_device6(status) |
|
|
|
|
return make_response("Device Id. not recognised. Must be between 1 and 6.", 400) |
|
|
|
|
return make_response("Invalid token.", 400) |
|
|
|
|
|
|
|
|
|
''' |
|
|
|
|
Nitty-Gritty Functions |
|
|
|
|