Closed danio0701 closed 5 years ago
Can you help me figure out what is happening?
I have errors in homebridge [2019-3-3 21:30:01] [dht22] DHT Status: 2, Temperature: 0, Humidity: 0 [2019-3-3 21:30:01] [dht22] Error: dht22 read failed with status 2
Sometimes temperature is read correctly. I'm sure that DHT11 is working fine as from AdaFruit DHT is read correctly if I will check this sensor using this script. From your script I have correct reply only on 5% of request.
Next:
[2019-3-3 21:31:01] [dht22] Error: dht22 read failed with status 2 <-- this reply is more often, due that temperature is not displayed correctly in Home app. [2019-3-3 21:32:01] [dht22] DHT Status: 0, Temperature: 26, Humidity: 38
Now I noticed also error: Error: dht22 read failed with status 3
If I will use dht22 command in terminal then output is: 3 0.0 C 0.0 % or 2 0.0 C 0.0 %
The plugin is just passing the errors it gets from the binary dht22. Try running it from the command line several times in a row, it should exhibit similar behaviour.
Do you have a wiring issue maybe?
On Mar 3, 2019, at 6:38 PM, danio0701 notifications@github.com wrote:
Can you help me figure out what is happening?
I have errors in homebridge [2019-3-3 21:30:01] [dht22] DHT Status: 2, Temperature: 0, Humidity: 0 [2019-3-3 21:30:01] [dht22] Error: dht22 read failed with status 2
Sometimes temperature is read correctly. I'm sure that DHT11 is working fine as from AdaFruit DHT is read correctly if I will check this sensor using this script. From your script I have correct reply only on 5% of request.
Next:
[2019-3-3 21:31:01] [dht22] Error: dht22 read failed with status 2 <-- this reply is more often, due that temperature is not displayed correctly in Home app. [2019-3-3 21:32:01] [dht22] DHT Status: 0, Temperature: 26, Humidity: 38
Now I noticed also error: Error: dht22 read failed with status 3
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
The plugin is just passing the errors it gets from the binary dht22. Try running it from the command line several times in a row, it should exhibit similar behavior. Do you have a wiring issue maybe? …
Do you have a wiring issue maybe? No, when I'm using Adafruit_Python_DHT then I always have temp and hum.
From terminal command DHT22:
2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 %
from AdafruitDHT (another solution I have this): pi@raspberrypi:~/Adafruit_Python_DHT/examples $ ./AdafruitDHT.py Temp=24.0* Humidity=33.0%
Sounds like the gpio pin configuration problem, the codebase assumes a connection to gpio 4. Where are you connected to?
Sent from my iPad
On Mar 3, 2019, at 6:48 PM, danio0701 notifications@github.com wrote:
The plugin is just passing the errors it gets from the binary dht22. Try running it from the command line several times in a row, it should exhibit similar behavior. Do you have a wiring issue maybe? …
Do you have a wiring issue maybe? No, when I'm using Adafruit_Python_DHT then I always have temp and hum.
From terminal command DHT22:
2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 %
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
I'm connected to gpio 4
Sometimes I got correct reply: 0 25.0 C 31.0 %
When I type command:
dht22 -g4 -i1 -m1 after 2 min of results 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % ...
I got this: 3 26.0 C 29.0 % 0 26.0 C 29.0 % 3 26.0 C 29.0 % 0 26.0 C 29.0 % 3 26.0 C 29.0 % 2 26.0 C 29.0 % 3 26.0 C 29.0 % 2 26.0 C 29.0 % 3 26.0 C 29.0 % 0 26.0 C 28.0 %
when I stopped command and start it again the result is: 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % 3 0.0 C 0.0 % 2 0.0 C 0.0 % ...
I’m not sure what is happening here as I’m using pigpiod to talk to the dht device and it seems to be having issues intermittently. The pigpiod library is here
http://abyz.me.uk/rpi/pigpio/index.html
I’m thinking it should be simple to switch to using the adafruit library instead, only problem is that I’m out of the country for a week and don’t have the ability to look at this in detail. The plugin just runs a command on the command line and parses the result from it.
Sent from my iPad
On Mar 4, 2019, at 3:39 AM, danio0701 notifications@github.com wrote:
I'm connected to gpio 4 (second pin on bottom)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
I’m not sure what is happening here as I’m using pigpiod to talk to the dht device and it seems to be having issues intermittently. The pigpiod library is here http://abyz.me.uk/rpi/pigpio/index.html I’m thinking it should be simple to switch to using the adafruit library instead, only problem is that I’m out of the country for a week and don’t have the ability to look at this in detail. The plugin just runs a command on the command line and parses the result from it. …
Oki, thanks a lot for suggestions :) I'm new in this so I will try to read more how to switch these libraries.
Is there source code of DHT22 file which I'm opening using command DHT22 and any instruction how to make from this code service again? I'm new in this stuff :P
Source is here
http://abyz.me.uk/rpi/pigpio/code/DHTXXD.zip
I did add a minor change to the source which is a patch in repo to include the Status and make the response easier to parse.
I generated new DHTXXD, only changes I made in test_DHTXXD to select manually that I have DHT11. Now I have this:
pi@raspberrypi:~/DHTXXD-2 $ ./DHTXXD -i1 2 0.0 0.0 3 0.0 0.0 2 0.0 0.0 3 0.0 0.0 2 0.0 0.0 3 0.0 0.0 2 0.0 0.0 3 0.0 0.0 2 0.0 0.0 3 0.0 0.0 2 0.0 0.0 3 0.0 0.0 0 26.0 37.0 3 26.0 37.0 2 26.0 37.0 3 26.0 37.0 0 26.0 35.0 3 26.0 35.0 0 26.0 34.0 3 26.0 34.0 0 26.0 34.0 3 26.0 34.0 0 26.0 33.0 3 26.0 33.0 2 26.0 33.0 3 26.0 33.0 0 26.0 30.0 3 26.0 30.0 0 26.0 29.0 3 26.0 29.0 0 26.0 28.0 3 26.0 28.0 0 26.0 30.0 3 26.0 30.0
Correct read is a show until I stop reading from the sensor. When I start again command ./DHTXXD -1 then again few first reads will be:
2 0.0 0.0 3 0.0 0.0 2 0.0 0.0 3 0.0 0.0 2 0.0 0.0
Sometimes this will not work and reads only 2 0.0 0.0 3 0.0 0.0 2 0.0 0.0 3 0.0 0.0 2 0.0 0.0 ...
It's too difficult for me
What I was thinking was to change the parsing logic here
To handle the response from the adafruit program, and ditch the dht22 binary going forward.
Still I do not understand how to do that but I noticed that if I will add to config.json of homebridge:
{ "accessory": "Dht", "name": "Test-DHT", "service": "dht22", "dhtExec": "/home/pi/Adafruit_Python_DHT/examples/AdafruitDHT.py" }
Run homebridge then I have something like this:
DHT Status: Temp=25.0, Temperature: NaN, Humidity: NaN [2019-3-6 23:17:50] [Test-DHT] Error: dht22 read failed with status Temp=25.0 [2019-3-6 23:18:56] [Test-DHT] DHT Status: Temp=25.0, Temperature: NaN, Humidity: NaN [2019-3-6 23:18:56] [Test-DHT] Error: dht22 read failed with status Temp=25.0
Temperature is reading correctly. Humidity is not displayed in this error. I will try to change output, maybe then this will be work :)
YES!!! It works! in homebridge config.json I add accessory:
{ "accessory": "Dht", "name": "Test-DHT", "service": "dht22", "dhtExec": "/home/pi/Adafruit_Python_DHT/examples/AdafruitDHT.py" }
and I changed code of AdafruitDHT.py output format and set this as defualt DHT11:
import sys
import Adafruit_DHT
humidity, temperature = Adafruit_DHT.read_retry(11, 4) if humidity is not None and temperature is not None: print('0 {0:0.1f} C {1:0.1f}%'.format(temperature, humidity)) else: print('Failed to get reading. Try again!') sys.exit(1)
Congrats
Sent from my iPad
On Mar 6, 2019, at 6:28 PM, danio0701 notifications@github.com wrote:
YES!!! It works! in homebridge config.json I add accessory:
{ "accessory": "Dht", "name": "Test-DHT", "service": "dht22", "dhtExec": "/home/pi/Adafruit_Python_DHT/examples/AdafruitDHT.py" }
and I changed code of AdafruitDHT.py output format and set this as defualt DHT11:
import sys
import Adafruit_DHT
humidity, temperature = Adafruit_DHT.read_retry(11, 4) if humidity is not None and temperature is not None: print('0 {0:0.1f} C {1:0.1f}%'.format(temperature, humidity)) else: print('Failed to get reading. Try again!') sys.exit(1)
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or mute the thread.
Congrats …
Thank you for assistance and suggestions ;)
I noticed that sometimes is error in reading sensor - randomly. dhtExec function failed: Error: Command failed: /home/pi/Adafruit_Python_DHT/examples/AdafruitDHT.py -g 4
but its not visible in Home app and values are constantly updated :)
Can you help me figure out what is happening?
I have errors in homebridge [2019-3-3 21:30:01] [dht22] DHT Status: 2, Temperature: 0, Humidity: 0 [2019-3-3 21:30:01] [dht22] Error: dht22 read failed with status 2
Sometimes temperature is read correctly. I'm sure that DHT11 is working fine as from AdaFruit DHT is read correctly if I will check this sensor using this script. From your script I have correct reply only on 5% of request.
Next:
[2019-3-3 21:31:01] [dht22] Error: dht22 read failed with status 2 <-- this reply is more often, due that temperature is not displayed correctly in Home app. [2019-3-3 21:32:01] [dht22] DHT Status: 0, Temperature: 26, Humidity: 38