DHT11 Help !!!
Moderator: leecollings
-
- Posts: 22
- Joined: Sunday 18 October 2020 21:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
DHT11 Help !!!
Hello everybody,I tried different tutorials but I can't add this sensor DHT11 in domoticz,please help me with an updated tutorial.
I thank you from the bottom of my heart.
I thank you from the bottom of my heart.
- kiddigital
- Posts: 435
- Joined: Thursday 10 August 2017 6:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DHT11 Help !!!
Please provide more details on your setup and how you have connected the sensor and which Domoticz hardware module you are trying to use for this.
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
One RPi with Pi foundation standard touch screen to display Dashticz
-
- Posts: 22
- Joined: Sunday 18 October 2020 21:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DHT11 Help !!!
ok,sorry for poor details,i use raspberry pi 3,and last version of domoticz,i succeed to conect and setup 4 5v relays and i need to add this sensor.
this is my conections:
vcc- +3,3v
gnd
signal - pin7
this is my conections:
vcc- +3,3v
gnd
signal - pin7
- Attachments
-
- 2.jpg (36.16 KiB) Viewed 1543 times
-
- 1.jpg (53.58 KiB) Viewed 1543 times
-
- Posts: 229
- Joined: Wednesday 30 April 2014 20:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: The Netherlands
- Contact:
- kiddigital
- Posts: 435
- Joined: Thursday 10 August 2017 6:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DHT11 Help !!!
@arhangel76 ,
There are a few options/path you can look at. It does not work straight out of the box without doing anything.
There are a few 'hardware' modules to try:
- 1-Wire (System)
- generic sysgpio
- I2C sensors
- Raspberry GPIO sensors
Your sensor is not an I2C sensor and as far as I know not a (Dallas) 1-Wire compatible sensor, so I would guess to start with GPIO.
I know that I have a few sensor on my raspberry (the one that runs Domoticz) through a HAT board (Automation HAT) where Domoticz reads the data using the 'generic sysgpio' module. But therefor I have to 'configure' sysfs GPIO (tell which gpio pins have which function) at boot before starting Domoticz.
From the sourcecode of the 'Raspberry GPIO sensors': (Maybe start here?)
There are a few options/path you can look at. It does not work straight out of the box without doing anything.
There are a few 'hardware' modules to try:
- 1-Wire (System)
- generic sysgpio
- I2C sensors
- Raspberry GPIO sensors
Your sensor is not an I2C sensor and as far as I know not a (Dallas) 1-Wire compatible sensor, so I would guess to start with GPIO.
I know that I have a few sensor on my raspberry (the one that runs Domoticz) through a HAT board (Automation HAT) where Domoticz reads the data using the 'generic sysgpio' module. But therefor I have to 'configure' sysfs GPIO (tell which gpio pins have which function) at boot before starting Domoticz.
From the sourcecode of the 'Raspberry GPIO sensors': (Maybe start here?)
Code: Select all
Connection information:
This hardware uses the pins of the Raspebrry Pi's GPIO port.
Please read:
http://wiringpi.com/pins/special-pin-functions/
http://wiringpi.com/pins/ for more information
As we cannot assume domoticz runs as root (which is bad), we won't take advantage of wiringPi's numbering.
Consequently, we will always use the internal GPIO pin numbering as noted the board, including in the commands below
Pins have to be exported and configured beforehand and upon each reboot of the Pi, like so:
- For output pins, only one command is needed:
gpio export <pin> out
- For input pins, 2 commands are needed (one to export as input, and one to trigger interrupts on both edges):
gpio export <pin> in
gpio edge <pin> both
Note: If you wire a pull-up, make sure you use 3.3V from P1-01, NOT the 5V pin ! The inputs are 3.3V max !
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
One RPi with Pi foundation standard touch screen to display Dashticz
-
- Posts: 22
- Joined: Sunday 18 October 2020 21:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DHT11 Help !!!
the idea is that in the command line it works perfectly what I want is to add it in the web page
- kiddigital
- Posts: 435
- Joined: Thursday 10 August 2017 6:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DHT11 Help !!!
Therefor one of the hardware modules should be able to read the sensor and put the readings into sensors.
Or do it yourself through scripts (using a Dummy sensor), see earlier suggestion.
The forum and Wiki have plenty examples.
Or do it yourself through scripts (using a Dummy sensor), see earlier suggestion.
The forum and Wiki have plenty examples.
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
One RPi with Pi foundation standard touch screen to display Dashticz
-
- Posts: 22
- Joined: Sunday 18 October 2020 21:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DHT11 Help !!!
So there is no exact tutorial for such a thing....
im beginer and i dont understand all....
im beginer and i dont understand all....
- kiddigital
- Posts: 435
- Joined: Thursday 10 August 2017 6:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DHT11 Help !!!
Not that I know off, but maybe we can help one step at the time...
You say it works from the commandline. Can you show your command(s) and the output per command?
You say it works from the commandline. Can you show your command(s) and the output per command?
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
One RPi with Pi foundation standard touch screen to display Dashticz
-
- Posts: 22
- Joined: Sunday 18 October 2020 21:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
DHT11 Help !!!
Ok i will post that...
Thank for try to help me
Thank for try to help me
-
- Posts: 22
- Joined: Sunday 18 October 2020 21:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
- kiddigital
- Posts: 435
- Joined: Thursday 10 August 2017 6:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DHT11 Help !!!
Ok, so you run a script. If you post the content of the script, than will tell use more.
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
One RPi with Pi foundation standard touch screen to display Dashticz
-
- Posts: 22
- Joined: Sunday 18 October 2020 21:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DHT11 Help !!!
#!/bin/sh
# Domoticz server
SERVER="127.0.0.1:8080"
# DHT IDX
DHTIDX="10"
# DHTPIN
DHTPIN="4"
sleep 5
sudo nice -20 python /home/root/domoticz/scripts/Adafruit_Python_DHT/examples/AdafruitDHT.py 11 $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://$SERVER/json.htm?type=command¶m=udevice&idx=$DHTIDX&nvalue=0&svalue=$TE$
#echo curl -s -i -H "Accept: application/json" "http://$SERVER/json.htm?type=command¶m=udevice&idx=$DHTIDX&nvalue=0&sval$
TEMP=""
HUM=""
# Domoticz server
SERVER="127.0.0.1:8080"
# DHT IDX
DHTIDX="10"
# DHTPIN
DHTPIN="4"
sleep 5
sudo nice -20 python /home/root/domoticz/scripts/Adafruit_Python_DHT/examples/AdafruitDHT.py 11 $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://$SERVER/json.htm?type=command¶m=udevice&idx=$DHTIDX&nvalue=0&svalue=$TE$
#echo curl -s -i -H "Accept: application/json" "http://$SERVER/json.htm?type=command¶m=udevice&idx=$DHTIDX&nvalue=0&sval$
TEMP=""
HUM=""
- kiddigital
- Posts: 435
- Joined: Thursday 10 August 2017 6:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DHT11 Help !!!
Ok, your script look (almost) ok.arhangel76 wrote:Code: Select all
#!/bin/sh # Domoticz server SERVER="127.0.0.1:8080" # DHT IDX DHTIDX="10" # DHTPIN DHTPIN="4" sleep 5 sudo nice -20 python /home/root/domoticz/scripts/Adafruit_Python_DHT/examples/AdafruitDHT.py 11 $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://$SERVER/json.htm?type=command¶m=udevice&idx=$DHTIDX&nvalue=0&svalue=$TE$ #echo curl -s -i -H "Accept: application/json" "http://$SERVER/json.htm?type=command¶m=udevice&idx=$DHTIDX&nvalue=0&sval$ TEMP="" HUM=""
Can you show the Devices overview of Domoticz? Especially Device with idx 10 as your script uses that one?
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
One RPi with Pi foundation standard touch screen to display Dashticz
-
- Posts: 22
- Joined: Sunday 18 October 2020 21:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DHT11 Help !!!
do you mean this?
#! /bin/bash
printf "Set GPIO"
printf "\n"
#relay pos1
echo 17 > /sys/class/gpio/export
sudo sh -c "echo '1' >> /sys/class/gpio/gpio17/active_low"
echo high > /sys/class/gpio/gpio17/direction
#relay pos2
echo 27 > /sys/class/gpio/export
sudo sh -c "echo '1' >> /sys/class/gpio/gpio27/active_low"
echo high > /sys/class/gpio/gpio27/direction
#relay pos3
echo 22 > /sys/class/gpio/export
sudo sh -c "echo '1' >> /sys/class/gpio/gpio22/active_low"
echo high > /sys/class/gpio/gpio22/direction
#relay pos4
echo 23 > /sys/class/gpio/export
sudo sh -c "echo '1' >> /sys/class/gpio/gpio23/active_low"
echo high > /sys/class/gpio/gpio23/direction
exit 0
#! /bin/bash
printf "Set GPIO"
printf "\n"
#relay pos1
echo 17 > /sys/class/gpio/export
sudo sh -c "echo '1' >> /sys/class/gpio/gpio17/active_low"
echo high > /sys/class/gpio/gpio17/direction
#relay pos2
echo 27 > /sys/class/gpio/export
sudo sh -c "echo '1' >> /sys/class/gpio/gpio27/active_low"
echo high > /sys/class/gpio/gpio27/direction
#relay pos3
echo 22 > /sys/class/gpio/export
sudo sh -c "echo '1' >> /sys/class/gpio/gpio22/active_low"
echo high > /sys/class/gpio/gpio22/direction
#relay pos4
echo 23 > /sys/class/gpio/export
sudo sh -c "echo '1' >> /sys/class/gpio/gpio23/active_low"
echo high > /sys/class/gpio/gpio23/direction
exit 0
- kiddigital
- Posts: 435
- Joined: Thursday 10 August 2017 6:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DHT11 Help !!!
Not really, this is a different script. When do you run this script?
Please make a screenshot of Domoticz Device settings screen showing Device 10
Please make a screenshot of Domoticz Device settings screen showing Device 10
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
One RPi with Pi foundation standard touch screen to display Dashticz
-
- Posts: 22
- Joined: Sunday 18 October 2020 21:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DHT11 Help !!!
I have conected 4 relays and work greate,
https://prnt.sc/v51nva
https://prnt.sc/v51o3x
https://prnt.sc/v51oe4
https://prnt.sc/v51oob
https://prnt.sc/v51nva
https://prnt.sc/v51o3x
https://prnt.sc/v51oe4
https://prnt.sc/v51oob
- kiddigital
- Posts: 435
- Joined: Thursday 10 August 2017 6:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DHT11 Help !!!
Try changing this line:arhangel76 wrote:Code: Select all
#!/bin/sh # Domoticz server SERVER="127.0.0.1:8080" # DHT IDX DHTIDX="10" # DHTPIN DHTPIN="4" sleep 5 sudo nice -20 python /home/root/domoticz/scripts/Adafruit_Python_DHT/examples/AdafruitDHT.py 11 $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
Code: Select all
# Send data
curl -s -i -H "Accept: application/json" "http://$SERVER/json.htm?type=command¶m=udevice&idx=$DHTIDX&nvalue=$TEMP&svalue=$TEMP
Also it also sends $TEMP instead of $TE$. (Is that a typo?)
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
One RPi with Pi foundation standard touch screen to display Dashticz
-
- Posts: 22
- Joined: Sunday 18 October 2020 21:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DHT11 Help !!!
probably the editing error
-
- Posts: 22
- Joined: Sunday 18 October 2020 21:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DHT11 Help !!!
not work...
https://prnt.sc/v51yp5
https://prnt.sc/v51yp5
Who is online
Users browsing this forum: No registered users and 0 guests