Handle 4 basic events and pretend to process a card

This commit is contained in:
Matthew Frost 2023-10-31 10:26:02 +01:00
parent 573fb1c829
commit 580b0d4efe

View file

@ -19,6 +19,7 @@ def send_http_post(prefix,value):
response = requests.post(url, data=data_to_post) response = requests.post(url, data=data_to_post)
if response.status_code is 200: if response.status_code is 200:
print(f"Sent FULL_CARD_ID: {value} via HTTP POST successfully") print(f"Sent FULL_CARD_ID: {value} via HTTP POST successfully")
ser.write("unlock".encode('utf-8'))
else: else:
print(f"Failed to send FULL_CARD_ID via HTTP POST. Status code: {response.status_code}") print(f"Failed to send FULL_CARD_ID via HTTP POST. Status code: {response.status_code}")
@ -35,7 +36,8 @@ try:
actions = { actions = {
"LOG_MSG": handle_log_msg, "LOG_MSG": handle_log_msg,
"FULL_CARD_ID": send_http_post, "FULL_CARD_ID": send_http_post,
"DOOR_DISABLED_STATUS": handle_log_msg "DOOR_DISABLED_STATUS": handle_log_msg,
"DOOR_LOCK_STATUS": handle_log_msg
} }
if prefix in actions: if prefix in actions: