From 7f90e104d3cbee938a49db77cbeb9b39b71bafed Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Sun, 12 Jun 2022 21:53:37 +0300 Subject: [PATCH] sql_app: emergency open time For some reason, having 3600 set as the time for door to stay open in a case of fire does not open the door at all. Prob a limtiation in door implementation Signed-off-by: HeshamTB --- sql_app/main.py | 4 ++-- sql_app/utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sql_app/main.py b/sql_app/main.py index 66669ba..3a1730b 100644 --- a/sql_app/main.py +++ b/sql_app/main.py @@ -6,7 +6,7 @@ from sqlalchemy.orm import Session from . import crud, models, schemas, auth_helper, init_db from .database import SessionLocal, engine -from .utils import get_db, EMERG_SMOKE, EMERG_TEMP, T_HOUR_SEC +from .utils import get_db, EMERG_SMOKE, EMERG_TEMP, EMERG_OPEN_TIME_SEC from typing import List from datetime import timedelta, datetime @@ -404,7 +404,7 @@ def polling_method_for_room_monitor(request: schemas.MonitorUpdateReadings, print("********EMERGENCY AT %s********" % device.description) door : models.IotEntity = device.door print("********OPENING DOOR %s ID:%d********" % (door.description, door.id)) - crud.set_open_door_request(db, door.id, T_HOUR_SEC) + crud.set_open_door_request(db, door.id, EMERG_OPEN_TIME_SEC) crud.record_emergancy_entry(db, request, device.id) # Call into a hook to notify with room and people diff --git a/sql_app/utils.py b/sql_app/utils.py index e2daf78..50ec5e8 100644 --- a/sql_app/utils.py +++ b/sql_app/utils.py @@ -10,4 +10,4 @@ def get_db(): EMERG_TEMP = 50 EMERG_SMOKE = 1000 -T_HOUR_SEC = 3600 +EMERG_OPEN_TIME_SEC = 500