Support for missing readings #364

Open
opened 2020-10-26 21:31:19 +00:00 by Pi-Tim · 10 comments
Pi-Tim commented 2020-10-26 21:31:19 +00:00 (Migrated from github.com)

Hi, I'm a complete noob to Linux, Python and Pi and I'm looking for some help getting my DHT22 readings into the Enclosure plugin please as I cannot figure out what I am doing wrong after lots of hours of failing to fix it. Details:

  • Pi B+ (yes, it is old) overclocked to 900Mhz running OctoPrint v1.4.2 with Enclosure plugin v4.13.1
  • DHT 22 sensor on GPIO pin 4 and currently on 5v to see if it helped instead of 3.3v
  • Running test script in terminal I get a response like this (must be run as sudo or fails to get readings):
    image
  • Running in sudo in the plugin give 0'c readings and throws an error as such in the Octoprint.log:
    image
  • I've read about this so have removed sudo in the advanced settings:
    image

This leaves me with where I'm at now, no readings at all, not even a 0 reading:
image

I'm sure I've made a complete novice error but I cannot work it out, do you have any suggestions at all please?

Hi, I'm a complete noob to Linux, Python and Pi and I'm looking for some help getting my DHT22 readings into the Enclosure plugin please as I cannot figure out what I am doing wrong after lots of hours of failing to fix it. Details: - Pi B+ (yes, it is old) overclocked to 900Mhz running OctoPrint v1.4.2 with Enclosure plugin v4.13.1 - DHT 22 sensor on GPIO pin 4 and currently on 5v to see if it helped instead of 3.3v - Running test script in terminal I get a response like this (must be run as sudo or fails to get readings): ![image](https://user-images.githubusercontent.com/73500985/97230213-7bf21b00-17d1-11eb-9dae-3666075a67cb.png) - Running in sudo in the plugin give 0'c readings and throws an error as such in the Octoprint.log: ![image](https://user-images.githubusercontent.com/73500985/97230349-b0fe6d80-17d1-11eb-8063-0251f8d0c502.png) - I've read about this so have removed sudo in the advanced settings: ![image](https://user-images.githubusercontent.com/73500985/97230465-de4b1b80-17d1-11eb-9d30-bbeaaa0cdb69.png) This leaves me with where I'm at now, no readings at all, not even a 0 reading: ![image](https://user-images.githubusercontent.com/73500985/97230815-84972100-17d2-11eb-8c06-ee9a53ee49a3.png) I'm sure I've made a complete novice error but I cannot work it out, do you have any suggestions at all please?
vitormhenrique commented 2020-10-26 21:40:15 +00:00 (Migrated from github.com)

try the following:

sudo rpi-update

to make sure you are using a recent kernel, and

sudo apt-get update
sudo apt-get upgrade

to make sure you are using a recent RPi.GPIO.

You will also need to make sure you are a member of the gpio group:

sudo adduser pi gpio
sudo chown root.gpio /dev/gpiomem
sudo chmod g+rw /dev/gpiomem
sudo chown root.gpio /dev/mem

try running the script without sudo now...

try the following: `sudo rpi-update` to make sure you are using a recent kernel, and ``` sudo apt-get update sudo apt-get upgrade ``` to make sure you are using a recent RPi.GPIO. You will also need to make sure you are a member of the gpio group: ``` sudo adduser pi gpio sudo chown root.gpio /dev/gpiomem sudo chmod g+rw /dev/gpiomem sudo chown root.gpio /dev/mem ``` try running the script without sudo now...
vitormhenrique commented 2020-10-26 21:40:38 +00:00 (Migrated from github.com)

Also, after saving the settings try to reboot octoprint...

Also, after saving the settings try to reboot octoprint...
Pi-Tim commented 2020-10-26 22:00:15 +00:00 (Migrated from github.com)

Thank you for the very quick response, @vitormhenrique.

I did these a few times on Saturday when installing the DHT 22:
sudo apt-get update sudo apt-get upgrade

User Pi says already has GPIO access when I type:
sudo adduser pi gpio

No feedback in Terminal at all when I type in these commands but I presume they are working as no errors are presented:
sudo chown root.gpio /dev/gpiomem sudo chmod g+rw /dev/gpiomem sudo chown root.gpio /dev/mem

Rebooted after all of the above and the test only works as sudo still so now I'm running...
sudo rpi-update
...then I'll try again!

Thank you for the very quick response, @vitormhenrique. I did these a few times on Saturday when installing the DHT 22: `sudo apt-get update sudo apt-get upgrade` User Pi says already has GPIO access when I type: `sudo adduser pi gpio` No feedback in Terminal at all when I type in these commands but I presume they are working as no errors are presented: `sudo chown root.gpio /dev/gpiomem sudo chmod g+rw /dev/gpiomem sudo chown root.gpio /dev/mem` Rebooted after all of the above and the test only works as sudo still so now I'm running... `sudo rpi-update` ...then I'll try again!
Pi-Tim commented 2020-10-26 22:29:45 +00:00 (Migrated from github.com)

Ok, so I have run through every one of your steps in order now just to make sure (thank you for posting them). So RPi updated, then get update and upgrade, the other steps, the reboot. In Terminal sudo is still needed to get a result, and I'm guessing this is my fundamental issue that is stopping the plugin from retrieving values too?

image

Ok, so I have run through every one of your steps in order now just to make sure (thank you for posting them). So RPi updated, then get update and upgrade, the other steps, the reboot. In Terminal sudo is still needed to get a result, and I'm guessing this is my fundamental issue that is stopping the plugin from retrieving values too? ![image](https://user-images.githubusercontent.com/73500985/97235391-aa282880-17da-11eb-966a-2d8c356b85ad.png)
Pi-Tim commented 2020-10-26 23:17:12 +00:00 (Migrated from github.com)

I'm there, issue resolved after far too many hours of fiddling. I went into the interfacing options on raspi-config (again) and re-did a few of them. I'm not sure which change made the difference (GPIO remote access was already on) but it worked. Thank you, @vitormhenrique for your help too.

image

I'm there, issue resolved after far too many hours of fiddling. I went into the interfacing options on raspi-config (again) and re-did a few of them. I'm not sure which change made the difference (GPIO remote access was already on) but it worked. Thank you, @vitormhenrique for your help too. ![image](https://user-images.githubusercontent.com/73500985/97238446-5cfb8500-17e1-11eb-8318-1839261a7901.png)
fallonk commented 2020-10-29 03:21:00 +00:00 (Migrated from github.com)

I just decided to add an AM2302 temp sensor to my control box, and I'm having the same issue. The enclosure plugin is only seeing 0' and 0% results. I got the right sensor selected and the right GPIO entered as well. All the prereq's are installed as well - and the example script works just fine (as both root (with sudo) and pi users). So, I know the hardware and even the software actually works - but I can't get it to pull a reading in the plugin. I've done some of the above poking around as well, and even ran rpi-update to update the firmware. suggestions?

  Temperature Humidity
Internal Temperature 0 °C 0 %
------------------------------------------------------------------------------
OctoPrint version : 1.4.2
OctoPi version    : 0.17.0
------------------------------------------------------------------------------

pi@octopi:~/Adafruit_Python_DHT/examples $ ./AdafruitDHT.py 2302 4
Temp=29.4*  Humidity=33.9%
pi@octopi:~/Adafruit_Python_DHT/examples $ sudo !!
sudo ./AdafruitDHT.py 2302 4
[sudo] password for pi:
Temp=29.3*  Humidity=33.9%
pi@octopi:~/Adafruit_Python_DHT/examples $

I just decided to add an AM2302 temp sensor to my control box, and I'm having the same issue. The enclosure plugin is only seeing 0' and 0% results. I got the right sensor selected and the right GPIO entered as well. All the prereq's are installed as well - and the example script works just fine (as both root (with sudo) and pi users). So, I know the hardware and even the software actually works - but I can't get it to pull a reading in the plugin. I've done some of the above poking around as well, and even ran rpi-update to update the firmware. suggestions?   | Temperature | Humidity -- | -- | -- Internal Temperature | 0 °C | 0 % ``` ------------------------------------------------------------------------------ OctoPrint version : 1.4.2 OctoPi version : 0.17.0 ------------------------------------------------------------------------------ pi@octopi:~/Adafruit_Python_DHT/examples $ ./AdafruitDHT.py 2302 4 Temp=29.4* Humidity=33.9% pi@octopi:~/Adafruit_Python_DHT/examples $ sudo !! sudo ./AdafruitDHT.py 2302 4 [sudo] password for pi: Temp=29.3* Humidity=33.9% pi@octopi:~/Adafruit_Python_DHT/examples $ ```
vitormhenrique commented 2020-11-11 04:01:56 +00:00 (Migrated from github.com)

have you tried again disabling he root on the advanced section?

have you tried again disabling he root on the advanced section?
n0t49a1n commented 2020-11-17 10:28:56 +00:00 (Migrated from github.com)

have you tried again disabling he root on the advanced section?

i have same issue and yes sudo is unticked

> have you tried again disabling he root on the advanced section? i have same issue and yes sudo is unticked
fallonk commented 2020-12-10 05:13:50 +00:00 (Migrated from github.com)

It does not matter if I sudo or not. It looks like there's something odd about the pulling of the data into the variables. I've even removed and reinstalled the plugin.

2020-12-10 00:10:02,791 - octoprint.plugins.enclosure - DEBUG - Temperature dht cmd: python /home/pi/oprint/lib/python3.7/site-packages/octoprint_enclosure/getDHTTemp.py 2302 4
2020-12-10 00:10:04,007 - octoprint.plugins.enclosure - DEBUG - Dht result: b'26.9 | 31.4\n'
2020-12-10 00:10:04,008 - octoprint.plugins.enclosure - INFO - Failed to execute python scripts, try disabling use SUDO on advanced section of the plugin.
2020-12-10 00:10:04,008 - octoprint.plugins.enclosure - WARNING - An exception of type TypeError occurred on log_error. Arguments:
("a bytes-like object is required, not 'str'",)
2020-12-10 00:10:04,009 - octoprint.plugins.enclosure - DEBUG - Sensor AM2302 Temperature: 0.0 humidity 0.0

pi@octopi:~ $ python -V
Python 2.7.16
pi@octopi:~ $ python /home/pi/oprint/lib/python3.7/site-packages/octoprint_enclosure/getDHTTemp.py 2302 4
26.6 | 32.0

It does not matter if I sudo or not. It looks like there's something odd about the pulling of the data into the variables. I've even removed and reinstalled the plugin. ``` 2020-12-10 00:10:02,791 - octoprint.plugins.enclosure - DEBUG - Temperature dht cmd: python /home/pi/oprint/lib/python3.7/site-packages/octoprint_enclosure/getDHTTemp.py 2302 4 2020-12-10 00:10:04,007 - octoprint.plugins.enclosure - DEBUG - Dht result: b'26.9 | 31.4\n' 2020-12-10 00:10:04,008 - octoprint.plugins.enclosure - INFO - Failed to execute python scripts, try disabling use SUDO on advanced section of the plugin. 2020-12-10 00:10:04,008 - octoprint.plugins.enclosure - WARNING - An exception of type TypeError occurred on log_error. Arguments: ("a bytes-like object is required, not 'str'",) 2020-12-10 00:10:04,009 - octoprint.plugins.enclosure - DEBUG - Sensor AM2302 Temperature: 0.0 humidity 0.0 ``` pi@octopi:~ $ python -V Python 2.7.16 pi@octopi:~ $ python /home/pi/oprint/lib/python3.7/site-packages/octoprint_enclosure/getDHTTemp.py 2302 4 26.6 | 32.0
vitormhenrique commented 2020-12-10 20:13:38 +00:00 (Migrated from github.com)

@fallonk see how your octoprint is running under python3.7? look at it's path...

To get it working on python 3.7 you manually need to change some lines of code inside of the plugin, as described on other issues....

II'm working on python 3.7 version of the plugin but it will take few moths

@fallonk see how your octoprint is running under python3.7? look at it's path... To get it working on python 3.7 you manually need to change some lines of code inside of the plugin, as described on other issues.... II'm working on python 3.7 version of the plugin but it will take few moths
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/OctoPrint-Enclosure#364