cjkrolak / ThermostatSupervisor

supervisor to detect and correct thermostat deviations
MIT License
0 stars 0 forks source link

sht31: debug flag broken in flask server #743

Closed cjkrolak closed 10 months ago

cjkrolak commented 10 months ago

can't get sht31_flask_server debug mode to start, tried 1, True, -d=True, etc.

cjkrolak commented 10 months ago

debug flag is read in debug mode is never set.

SHT31 sensor Flask server
running on Python version 3.12
raspberry pi environment is detected
DEBUG: parent_keys = ['argv']
DEBUG: valid_sflags=['-d']
Flask debug mode=False
cjkrolak commented 10 months ago

all of these command line arguments returned False for the debug flag:

-d=True
-d=true
-d 1
-d True
-dtrue
cjkrolak commented 10 months ago

debug input parameter is being read in as None (regardless of the input value), which always translates to False.

-d 1 -> None -> False
-d=1 -> None -> False
--debug=1 -> None -> False
--debug=true -> None -> False
--debug=True -> None -> False

defect: util.log_msg(, mode=CONSOLE) does not print to Flask server, need to also output to ERROR

cjkrolak commented 10 months ago

root cause was type checking not working for bool vs. lambda. Lambda is required in user inputs to correctly get bool input values to work. Exception added to protect against this. Issue #747 found during this investigation as well, hiding the coding issue.