1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 02:14:26 +01:00

Add the current state to the response

Signed-off-by: Ralf Ramsauer <ralf@binary-kitchen.de>
This commit is contained in:
Ralf Ramsauer 2018-09-02 22:19:24 +00:00
parent 20c86eb659
commit 6977c46c5c

View File

@ -134,9 +134,10 @@ class AuthMethod(Enum):
class DoorState(Enum):
Open = 1
Present = 2
Closed = 3
# These numbers are used by the App since version 3.0, do NOT change them
Open = 0
Present = 1
Closed = 2
def from_string(string):
if string == 'lock':
@ -420,9 +421,9 @@ def api():
if response == LogicResponse.Success or \
response == LogicResponse.AlreadyLocked or \
response == LogicResponse.AlreadyOpen:
# TBD: Remove 'status'. No more users. Still used in App Version 2.0!
json['status'] = str(logic.state.to_html())
# TBD: Remove 'open'. No more users. Still used in App Version 2.1.1!
json['open'] = logic.state.is_open()
json['status'] = logic.state.value
return jsonify(json)
user = request.form.get('user')