Page 2 of 2
Re: DHT 11 on Raspberry 2
Posted: Friday 24 February 2017 19:12
by Spindi
HI guys!
So I now tested it with the resistor and it's working well now!
Thanks a lot ijobain!!!!!!!!!
Re: DHT 11 on Raspberry 2
Posted: Saturday 18 March 2017 9:16
by Kraod
Hello
I tried the solution in this post and it worked marvelously.
I have a question though: the script is written for a single dht, but I will have 5 of them in my house; is there a way to implement more in the same script or do I need to make a script for each of them ?
Re: DHT 11 on Raspberry 2
Posted: Monday 17 April 2017 19:35
by toontoon
For many hours I have been trying to get DHT11 working onRaspberry. when I read manually sudo ./AdafruitDHT.py 11 4 no problems, good reading. But if I try to use the mentioned program I get the same error as journeyman
File "dht11.py", line 12
sleep 5
^
SyntaxError: invalid syntax
Does anyone know how to fix this?
thanx!
Re: DHT 11 on Raspberry 2
Posted: Thursday 01 February 2018 18:08
by Pasibun
its been a year since some one posted something here.
But mayby some of you can help me out.
I got everything working except the bash script.
When i try to run the bash script i got this output:
Code: Select all
pi@raspberrypi:~ $ /home/pi/dev-domoticz/scripts/dht_22.sh
21.3
45.1
HTTP/1.1 401 Unauthorized
Content-Length: 91
Content-Type: text/html
Set-Cookie: SID=none; HttpOnly; Expires=Thu, 01 Jan 1970 00:00:00 GMT
<html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html
My bash script:
Code: Select all
#!/bin/sh
# Domoticz server
SERVER="10.0.0.110:8080"
# DHT IDX
DHTIDX="4"
# DHTPIN
DHTPIN="4"
# TEMP FILE
TMPFILE="/var/tmp/temp.txt"
cpt=0
while [ $cpt -lt 6 ]
do
TEMP=""
sleep 5
sudo nice -20 /home/pi/dev-domoticz/scripts/Adafruit_Python_DHT/examples/AdafruitDHT.py 22 $DHTPIN > /var/tmp/temp.txt
#TEMP=$(cat /var/tmp/temp.txt | grep "Temp" | awk '{ print $3 }')
#TEMP=$(cat /var/tmp/temp.txt | grep "Temp")
TEMP=$(awk ' /Temp/ {print substr ($0,6,4)}' /var/tmp/temp.txt)
#HUM=$(awk ' /Hudmidity/ {print substr ($0,0)}' /var/tmp/temp.txt)
#HUM=$(awk ' /Humidity/ {print 1$}' /var/tmp/temp.txt)
HUM=$(awk ' /Humidity/ {print substr ($0,22,4)}' /var/tmp/temp.txt)
echo $TEMP
echo $HUM
# Send data
curl -s -i -H "Accept: application/json" "http://10.0.0.110:8080/json.htm?type=command¶m=udevice&idx=$DHTIDX&nvalue=0&svalue=$TEMP;$HUM;2"
TEMP=""
HUM=""
#rm $TMPFILE
exit 0
#fi
#echo $cpt
cpt=$(($cpt+1))
done
exit 1
When i run this in the browser:
Code: Select all
http://10.0.0.110:8080/json.htm?type=command¶m=udevice&idx=4&nvalue=0&svalue=21;40;2
i receive:
Code: Select all
{
"status" : "OK",
"title" : "Update Device"
}
Can some one help me out here?
Re: DHT 11 on Raspberry 2
Posted: Friday 23 March 2018 13:52
by Smartie