GPIO DHT11 troubleshooting

More of a user error/Troubleshooting if I had to guess but i’m out of ideas. I have a DHT11 sensor i’m trying to get configured.

I created a python script as follows.

#import the GPIO and time package
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
#loop through 50 times, on/off for 1 second
for i in range(50):
GPIO.output(7,True)
time.sleep(4)
GPIO.output(7,False)
time.sleep(4)
GPIO.cleanup()

This toggles an led attached to pin 7 on the raspberry pi but I think this is known as BCM#4.

I’ve tried to add this in Mycodo as AOSONG DHT11:Humidity/Temperature(pigpio)[GPIO] inputs and as Seedstudio DHT11/DHT22: Humidity/Temperature (grovepi)[GROVE] inputs. I’ve copied these inputs and changed their pin GPIO numbers to 4 and 7.

To confirm my python script is running I’ve verified with a volt meter and its toggling the voltage at the 4 second interval.

I can’t get Data > Live Measurements page to show anything other than 0 on all the measurements though.

Model: Raspberry Pi 2 Model B Rev 1.1
Mycodo - 8.15.8 - 05/09

Its possible that I’ve fried my DHT sensor. Not sure where to go from here. I can order a different humidity temp sensor if there is something easier to get working but this could be user error as well.

Many Thanks in advance!

Think this might be a breadcrumb. I’ll see what I can find.

image

image

image

image

image

image

image

~
So i’m not sure if this was improper but I did it…

deleted f at line 43
image

image
deleted f at line 248
image

I reran the script and found the following error

I deleted the f at line 252
image

So not sure if I should have made those edits and not sure what the flask_babel story is but thats a good stopping point.

Update -
Well I can’t get into the webgui and i’m guessing its due to these changes but I can save the config as a backup then revert to prove it out.
image

https://kizniche.github.io/Mycodo/Troubleshooting/

image

mv ~/Mycodo/databases/mycodo.db ~/Mycodo/databases/mycodo.db.backup
sudo service mycodoflask restart

image

Looks like this kicked off some different services but the webpage still doesn’t load.

Performed a reboot…

Error 502: Bad Gateway Error

persisted after a reboot.

smguth@mycodo:~ $ journalctl -u mycodoflask | tail -n 50
May 11 19:12:41 mycodo python[684]: return _bootstrap._gcd_import(name[level:], package, level)
May 11 19:12:41 mycodo python[684]: File “”, line 1006, in _gcd_import
May 11 19:12:41 mycodo python[684]: File “”, line 983, in _find_and_load
May 11 19:12:41 mycodo python[684]: File “”, line 967, in _find_and_load_unlocked
May 11 19:12:41 mycodo python[684]: File “”, line 677, in _load_unlocked
May 11 19:12:41 mycodo python[684]: File “”, line 728, in exec_module
May 11 19:12:41 mycodo python[684]: File “”, line 219, in _call_with_frames_removed
May 11 19:12:41 mycodo python[684]: File “/home/smguth/Mycodo/mycodo/start_flask_ui.py”, line 13, in
May 11 19:12:41 mycodo python[684]: app = create_app() # required by the wsgi config and main()
May 11 19:12:41 mycodo python[684]: File “/home/smguth/Mycodo/mycodo/mycodo_flask/app.py”, line 46, in create_app
May 11 19:12:41 mycodo python[684]: register_extensions(app)
May 11 19:12:41 mycodo python[684]: File “/home/smguth/Mycodo/mycodo/mycodo_flask/app.py”, line 80, in register_extensions
May 11 19:12:41 mycodo python[684]: misc = new_session.query(Misc).first()
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/orm/query.py”, line 2752, in first
May 11 19:12:41 mycodo python[684]: return self.limit(1)._iter().first() # type: ignore
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/orm/query.py”, line 2858, in _iter
May 11 19:12:41 mycodo python[684]: execution_options={“_sa_orm_load_options”: self.load_options},
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/orm/session.py”, line 2235, in execute
May 11 19:12:41 mycodo python[684]: _add_event=_add_event,
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/orm/session.py”, line 2130, in _execute_internal
May 11 19:12:41 mycodo python[684]: conn,
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/orm/context.py”, line 254, in orm_execute_statement
May 11 19:12:41 mycodo python[684]: statement, params or {}, execution_options=execution_options
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/engine/base.py”, line 1417, in execute
May 11 19:12:41 mycodo python[684]: execution_options or NO_OPTIONS,
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/sql/elements.py”, line 487, in _execute_on_connection
May 11 19:12:41 mycodo python[684]: self, distilled_params, execution_options
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/engine/base.py”, line 1648, in _execute_clauseelement
May 11 19:12:41 mycodo python[684]: cache_hit=cache_hit,
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/engine/base.py”, line 1843, in _execute_context
May 11 19:12:41 mycodo python[684]: dialect, context, statement, parameters
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/engine/base.py”, line 1984, in _exec_single_context
May 11 19:12:41 mycodo python[684]: e, str_statement, effective_parameters, cursor, context
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/engine/base.py”, line 2326, in _handle_dbapi_exception
May 11 19:12:41 mycodo python[684]: raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/engine/base.py”, line 1965, in _exec_single_context
May 11 19:12:41 mycodo python[684]: cursor, str_statement, effective_parameters, context
May 11 19:12:41 mycodo python[684]: File “/var/mycodo-root/env/lib/python3.7/site-packages/sqlalchemy/engine/default.py”, line 748, in do_execute
May 11 19:12:41 mycodo python[684]: cursor.execute(statement, parameters)
May 11 19:12:41 mycodo python[684]: sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: misc
May 11 19:12:41 mycodo python[684]: [SQL: SELECT misc.id AS misc_id, misc.dismiss_notification AS misc_dismiss_notification, misc.force_https AS misc_force_https, misc.hide_alert_info AS misc_hide_alert_info, misc.hide_alert_success AS misc_hide_alert_success, misc.hide_alert_warning AS misc_hide_alert_warning, misc.hide_tooltips AS misc_hide_tooltips, misc.grid_cell_height AS misc_grid_cell_height, misc.login_message AS misc_login_message, misc.max_amps AS misc_max_amps, misc.output_usage_cost AS misc_output_usage_cost, misc.output_usage_currency AS misc_output_usage_currency, misc.output_usage_dayofmonth AS misc_output_usage_dayofmonth, misc.output_usage_volts AS misc_output_usage_volts, misc.output_usage_report_gen AS misc_output_usage_report_gen, misc.output_usage_report_span AS misc_output_usage_report_span, misc.output_usage_report_day AS misc_output_usage_report_day, misc.output_usage_report_hour AS misc_output_usage_report_hour, misc.sample_rate_controller_conditional AS misc_sample_rate_controller_conditional, misc.sample_rate_controller_function AS misc_sample_rate_controller_function, misc.sample_rate_controller_input AS misc_sample_rate_controller_input, misc.sample_rate_controller_math AS misc_sample_rate_controller_math, misc.sample_rate_controller_output AS misc_sample_rate_controller_output, misc.sample_rate_controller_pid AS misc_sample_rate_controller_pid, misc.sample_rate_controller_widget AS misc_sample_rate_controller_widget, misc.stats_opt_out AS misc_stats_opt_out, misc.enable_upgrade_check AS misc_enable_upgrade_check, misc.mycodo_upgrade_available AS misc_mycodo_upgrade_available, misc.rpyc_timeout AS misc_rpyc_timeout, misc.daemon_debug_mode AS misc_daemon_debug_mode, misc.net_test_ip AS misc_net_test_ip, misc.net_test_port AS misc_net_test_port, misc.net_test_timeout AS misc_net_test_timeout, misc.default_login_page AS misc_default_login_page, misc.measurement_db_retention_policy AS misc_measurement_db_retention_policy, misc.measurement_db_name AS misc_measurement_db_name, misc.measurement_db_version AS misc_measurement_db_version, misc.measurement_db_host AS misc_measurement_db_host, misc.measurement_db_port AS misc_measurement_db_port, misc.measurement_db_user AS misc_measurement_db_user, misc.measurement_db_password AS misc_measurement_db_password, misc.measurement_db_dbname AS misc_measurement_db_dbname
May 11 19:12:41 mycodo python[684]: FROM misc
May 11 19:12:41 mycodo python[684]: LIMIT ? OFFSET ?]
May 11 19:12:41 mycodo python[684]: [parameters: (1, 0)]
May 11 19:12:41 mycodo python[684]: (Background on this error at: https://sqlalche.me/e/20/e3q8)
May 11 19:12:41 mycodo python[684]: [2023-05-11 19:12:41 +0100] [755] [INFO] Worker exiting (pid: 755)
May 11 19:12:42 mycodo python[684]: [2023-05-11 19:12:42 +0100] [684] [INFO] Shutting down: Master
May 11 19:12:42 mycodo python[684]: [2023-05-11 19:12:42 +0100] [684] [INFO] Reason: Worker failed to boot.
May 11 19:12:42 mycodo systemd[1]: mycodoflask.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
May 11 19:12:42 mycodo systemd[1]: mycodoflask.service: Failed with result ‘exit-code’.

You should not be attempting to run anything outside the Mycodo virtualenv (~/Mycodo/env). The changes you made will break the system.

okay, I was just debating reinstalling Raspbian and starting clean. Think that might be fastest for me at this point.

I reinstalled my operating system I was using an old pi from 2019 hard to say what I had messed up on that build.