vitormhenrique / OctoPrint-Enclosure

OctoPrint Enclosure Plugin
GNU General Public License v3.0
396 stars 201 forks source link

No Sensor-readings, Variable "airquality" not declared for DHT11, DHT22, AM2302 ? #453

Closed manuelwolfcgm closed 2 years ago

manuelwolfcgm commented 2 years ago

Describe the bug No Readings for DHT11 (which is tested and had been working up to the latest push) and AM2302. The sensors are working fine and already have been working in the enclosure-plugin. I needed to reinstall the plugin - and after that, I cant get any readings any more, although the sensor is accesible via a test-script.

To Reproduce Fresh Plugin-Installation; Sensor shows no values; Log shows errors complaining about modifying a not-declared variable "airquality" in getDHTTemp.py

Expected behavior ....sensor should display values! (Tested via a smal test-py-script)

Additional context image

It seems that in the last push, there have been adjustments in getDHTTemp.py, especially adding handling of the airquality-variable. For Sensors DHT11, 22, AM2302, this variable isn't declared, is it? I'll try so switch line 1026 to its previous version, not using the airqualtity-parameter (which is not useful for me). Maybe this is enough change in my case... 2021-12-10 06_24_38-Window 2021-12-10 06_35_26-Window

manuelwolfcgm commented 2 years ago

....added "airquality = 0" in the if-clause for DHT11,22,2302 ( init.py )-> seems to work so far.... image image

plani-de commented 2 years ago

I had the same issue and adding the missing airquality = 0 line helped at first, but now I continously get the follwoing error message: `2021-12-11 20:47:18,056 - octoprint.plugins.enclosure - INFO - Failed to execute python scripts, try disabling use SUDO on advanced section of the plugin.

2021-12-11 20:47:18,057 - octoprint.plugins.enclosure - WARNING - An exception of type ValueError occurred on log_error. Arguments: ('not enough values to unpack (expected 2, got 1)',) Traceback (most recent call last): File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_enclosure/init.py", line 1127, in read_dht_temp temp, hum = stdout.decode("utf-8").split("|") ValueError: not enough values to unpack (expected 2, got 1) `

Anybody here who has an Idea. By the way, it makes no difference wether or not I disable/enable the "use SUDO". I also activated the logging function, but I get no futher details, e.g. what the AM2302 reads.

tanant commented 2 years ago

@plani-de not sure if it's the same cause however I'm talking through on #459 something that has the same error msg - I've put a rough summary of two things that I think are worth checking https://github.com/vitormhenrique/OctoPrint-Enclosure/issues/459#issuecomment-1038530919 if that helps any?

tanant commented 2 years ago

@manuelwolfcgm quick sanity check, do the changes in #461 (specifically commit https://github.com/vitormhenrique/OctoPrint-Enclosure/commit/e1f0372a63905f5f9de89b68c689aa5be6b209c5 ) cover what you did?

manuelwolfcgm commented 2 years ago

@manuelwolfcgm quick sanity check, do the changes in #461 (specifically commit e1f0372 ) cover what you did?

I did nothing more than this "airquality = 0" -> seems ok from my point of view

tanant commented 2 years ago

Gotcha, so yeah, that might mean this issue is resolved by #461, which is good to know

vitormhenrique commented 2 years ago

Fixed!