mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 10:24:26 +01:00
Add the current state to the response
Signed-off-by: Ralf Ramsauer <ralf@binary-kitchen.de>
This commit is contained in:
parent
20c86eb659
commit
6977c46c5c
11
doorlockd.py
11
doorlockd.py
@ -134,9 +134,10 @@ class AuthMethod(Enum):
|
|||||||
|
|
||||||
|
|
||||||
class DoorState(Enum):
|
class DoorState(Enum):
|
||||||
Open = 1
|
# These numbers are used by the App since version 3.0, do NOT change them
|
||||||
Present = 2
|
Open = 0
|
||||||
Closed = 3
|
Present = 1
|
||||||
|
Closed = 2
|
||||||
|
|
||||||
def from_string(string):
|
def from_string(string):
|
||||||
if string == 'lock':
|
if string == 'lock':
|
||||||
@ -420,9 +421,9 @@ def api():
|
|||||||
if response == LogicResponse.Success or \
|
if response == LogicResponse.Success or \
|
||||||
response == LogicResponse.AlreadyLocked or \
|
response == LogicResponse.AlreadyLocked or \
|
||||||
response == LogicResponse.AlreadyOpen:
|
response == LogicResponse.AlreadyOpen:
|
||||||
# TBD: Remove 'status'. No more users. Still used in App Version 2.0!
|
# TBD: Remove 'open'. No more users. Still used in App Version 2.1.1!
|
||||||
json['status'] = str(logic.state.to_html())
|
|
||||||
json['open'] = logic.state.is_open()
|
json['open'] = logic.state.is_open()
|
||||||
|
json['status'] = logic.state.value
|
||||||
return jsonify(json)
|
return jsonify(json)
|
||||||
|
|
||||||
user = request.form.get('user')
|
user = request.form.get('user')
|
||||||
|
Loading…
Reference in New Issue
Block a user