cjkrolak / ThermostatSupervisor

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

SHT31 internal server error #248

Open cjkrolak opened 2 years ago

cjkrolak commented 2 years ago

happened after session 3, poll 410:

Traceback (most recent call last): File "supervise.py", line 191, in main(api.user_inputs["thermostat_type"], api.user_inputs["zone"]) File "supervise.py", line 140, in main flag_all_deviations=revert_all_deviations) File "/home/pi/github/ThermostatSupervisor/thermostat_common.py", line 222, in get_current_mode self.query_thermostat_zone() File "/home/pi/github/ThermostatSupervisor/thermostat_common.py", line 116, in query_thermostat_zone self.humidity_is_available = self.get_is_humidity_supported() File "/home/pi/github/ThermostatSupervisor/sht31.py", line 301, in get_is_humidity_supported return self.get_display_humidity() is not None File "/home/pi/github/ThermostatSupervisor/sht31.py", line 293, in get_display_humidity raw_humidity = self.get_metadata(self.humidityfield) File "/home/pi/github/ThermostatSupervisor/sht31.py", line 266, in get_metadata self.get_metadata(parameter, retry=False) File "/home/pi/github/ThermostatSupervisor/sht31.py", line 271, in get_metadata (parameter, r.json())) from e Exception: FATAL ERROR: SHT31 server response did not contain key 'Humidity(%RH) mean', raw response={'message': 'Internal Server Error'}

cjkrolak commented 2 years ago

failure is due to a get error on the host side: 173.26..xxx.xxx - - [03/Dec/2021 07:19:48] "GET / HTTP/1.1" 200 - [2021-12-03 07:19:48,900] ERROR in app: Exception on / [GET] Traceback (most recent call last): File "/usr/lib/python3/dist-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3/dist-packages/flask/app.py", line 1799, in dispatch_request return self.view_functionsrule.endpoint File "/home/pi/.local/lib/python3.7/site-packages/flask_restful/init.py", line 467, in wrapper resp = resource(*args, kwargs) File "/usr/lib/python3/dist-packages/flask/views.py", line 88, in view return self.dispatch_request(*args, *kwargs) File "/home/pi/.local/lib/python3.7/site-packages/flask_restful/init.py", line 582, in dispatch_request resp = meth(args, kwargs) File "sht31_flask_server.py", line 112, in get return helper.get() File "sht31_flask_server.py", line 67, in get data = bus.read_i2c_block_data(i2c_address, 0x00, 6)

cjkrolak commented 2 years ago

restarting cmd prompt and rebooting pi did not resolve the issue, may need to troubleshoot locally. Remote IC test #137 may be helpful at further diagnosing this issue

cjkrolak commented 2 years ago

soft power cycle (remote) did not resolve the issue, but hard power cycle at the wall did resolve the issue

cjkrolak commented 2 years ago

this issue still requires a hard power cycle to clear, keeping issue open in hopes that a soft reset can be figured out to clear this error remotely.

cjkrolak commented 2 years ago

re-opening issue

cjkrolak commented 2 years ago

sudo i2cdetect -y 1 in the failing state is showing that i2c is not showing up at all, possible hardware issue. Goal of this ticket is to either prevent the issue or design a remote recovery process that does not require a local power cycle to clear.

cjkrolak commented 2 years ago

tried this i2c reset sequence but was unsuccessful:

disable the I2C driver with sudo rmmod i2c_dev: seemed to work sudo rmmod i2c_bcm2835: hung sudo i2cdetect -y 1: Could not open file /dev/i2c-1' or/dev/i2c/1' lsmod: i2c_bcm3835 used_by = -1 re-enable it with sudo modprobe i2c_bcm2835: hung sudo modprobe i2c_dev: didn't get this far

http://www.pibits.net/amp/learning/resetting-i2c-driver-raspberry-pi.php

cjkrolak commented 2 years ago

interesting thread on auto recover stuck bus: https://forums.raspberrypi.com/viewtopic.php?t=326603