I thank you from the bottom of my heart.

Moderator: leecollings
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 !
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=""
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
Users browsing this forum: No registered users and 1 guest