Bonjour à vous tous,
je suis novice avec un Raspberry Pi et les DHT22
je veux avoir la température et Humidité sur la page web de DOMOTICZ
en mode SSH avec cette fonction
sudo /home/pi/Adafruit_Python_DHT/examples/AdafruitDHT.py 22 2
je peux bien voir l'humidité et la température
mais comment faire pour l'avoir sur la page domoticz mes résultas
L'icone reste toujours a 76% humidité et 21.2 Celsius
je ne comprend pas commend faire pour envoyer ces bonne donner a la page web de
DOMOTICZ
avec :
sudo /home/pi/Adafruit_Python_DHT/examples/AdafruitDHT.py 22 2
je peux voir le résultas réel qui est 20.6 Celcius qui est la bonne température Humidité qui est de 63%
et non 76 qui est une faute lecture selon moi
Merci de votre aide
et bonne journée
DHT22 pas de donner dans DOMOTICZ
DHT22 pas de donner dans DOMOTICZ
- Pièces jointes
-
- Capture d’écran, le 2019-08-21 à 06.59.07.png (28.67 Kio) Consulté 2366 fois
-
- Capture d’écran, le 2019-08-21 à 06.56.39.png (232.98 Kio) Consulté 2366 fois
Re: DHT22 pas de donner dans DOMOTICZ
Salut, bienvenue !
D'où vient le device DHT22 visible sur l'interface web de ton domoticz ? Comment l'as tu créé ?
Le DHT22 utilise son protocole de comm, et pas de l'I2C, tu ne peux donc pas l'ajouter via un Matériel de type I2C sensors.
A ma connaissance Domoticz ne gère pas en natif les DHT22 connecté aux GPIO, tu peux toujours modifier le script d'Adafruit pour mettre à jour un device dummy de type température+hygrométrie mais moi je partirai bien direct sur un SI7021 géré en natif sur le bus I2C.
Je sais pas si je suis clair ?
A+
D'où vient le device DHT22 visible sur l'interface web de ton domoticz ? Comment l'as tu créé ?
Le DHT22 utilise son protocole de comm, et pas de l'I2C, tu ne peux donc pas l'ajouter via un Matériel de type I2C sensors.
A ma connaissance Domoticz ne gère pas en natif les DHT22 connecté aux GPIO, tu peux toujours modifier le script d'Adafruit pour mettre à jour un device dummy de type température+hygrométrie mais moi je partirai bien direct sur un SI7021 géré en natif sur le bus I2C.
Je sais pas si je suis clair ?
A+
Raspberry pi 3 - Domoticz 2024.4 | Piface v.2 + Téléinfo + RFXtrx433E
sondes Oregon | motorisations Somfy Yslo Flex 2 RTS
prises chacon, wifi | Sonoff easyESP, Tasmota, Espurna | ParadoxMG5050
sondes Oregon | motorisations Somfy Yslo Flex 2 RTS
prises chacon, wifi | Sonoff easyESP, Tasmota, Espurna | ParadoxMG5050
-
Chrominator
- Messages : 1042
- Inscription : 19 déc. 2015, 07:29
- Localisation : France
Re: DHT22 pas de donner dans DOMOTICZ
Un bon frein vaut mieux que deux sparadraps.
Ubuntu 24.04.3 LTS - Domoticz 2025.1 (build 16782)
Pentium G3220T 2.6GHz - 4Go DDR3
RFXtrx433 USB Ver Pro1/1043
Z-Stick GEN5 Version: 1.6-1136-g07ea22bb
Rtl433 RTL-SDR receiver
RFLink Gateway
Zigbee SLZB-06
Ubuntu 24.04.3 LTS - Domoticz 2025.1 (build 16782)
Pentium G3220T 2.6GHz - 4Go DDR3
RFXtrx433 USB Ver Pro1/1043
Z-Stick GEN5 Version: 1.6-1136-g07ea22bb
Rtl433 RTL-SDR receiver
RFLink Gateway
Zigbee SLZB-06
Re: DHT22 pas de donner dans DOMOTICZ
Bonjour a vous deux qui mon répondu,
donc si je comprend bien le DHT22 ne dois pas être brancher sur les port I2C
mais bien sur un autre GPIO
ha c' est peux être cela qui ce passe,
et pour le site
https://easydomoticz.com/dht-11-22-rasp ... che-enfin/
c' est mon point de départ pour le DHT22
et je ne suis pas capable
mais comme vous me l'avez appris c' est peux être que je n'utilise pas le bon GPIO
Merci je vais faire des test ce soir
donc si je comprend bien le DHT22 ne dois pas être brancher sur les port I2C
mais bien sur un autre GPIO
ha c' est peux être cela qui ce passe,
et pour le site
https://easydomoticz.com/dht-11-22-rasp ... che-enfin/
c' est mon point de départ pour le DHT22
et je ne suis pas capable
mais comme vous me l'avez appris c' est peux être que je n'utilise pas le bon GPIO
Merci je vais faire des test ce soir
Re: DHT22 pas de donner dans DOMOTICZ
Bonjour à vous,
je repris a partir du début avec ma micro carte SD
et j'arrive pas a avoir les résultas sur la page DOMOTICZ
voici des info pour mieux trouver mon problème et comprendre pourquoi aussi:
Sur ma page Domoticz j'ai 50% avec 0 Celsius pour mon AM 2302
je les branché sur la pin 18 du Raspberry Pi soit le GPIO 24
J'execute un fonction pour savoir si mon AM2302 est bien branché et voici la réponse que je reçois sur une page WEB
http://10.192.17.104:8080/json.htm?type=devices&ridx=2
{
"ActTime" : 1566507843,
"app_version" : "4.10717",
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "24.2 C",
"Description" : "",
"Favorite" : 1,
"HardwareID" : 2,
"HardwareName" : "18B20",
"HardwareType" : "1-Wire (System)",
"HardwareTypeVal" : 12,
"HaveTimeout" : false,
"ID" : "AAAF",
"LastUpdate" : "2019-08-22 17:00:39",
"Name" : "Temp TS2000",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" : [ 0 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "LaCrosse TX3",
"Temp" : 24.199999999999999,
"Timers" : "false",
"Type" : "Temp",
"TypeImg" : "temperature",
"Unit" : 175,
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "1",
"trend" : 1
},
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "0.0 C, 50 %",
"Description" : "",
"DewPoint" : "-9.20",
"Favorite" : 1,
"HardwareID" : 3,
"HardwareName" : "DHT",
"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
"HardwareTypeVal" : 15,
"HaveTimeout" : false,
"Humidity" : 50,
"HumidityStatus" : "Comfortable",
"ID" : "14052",
"LastUpdate" : "2019-08-22 16:27:41",
"Name" : "DHT",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" : [ 0 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "THGN122/123/132, THGR122/228/238/268",
"Temp" : 0.0,
"Timers" : "false",
"Type" : "Temp + Humidity",
"TypeImg" : "temperature",
"Unit" : 1,
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "2",
"trend" : 0
}
],
"status" : "OK",
"title" : "Devices"
}
et Voici mon script qui est dans
/home/pi/Adafruit_Python_DHT/examples/AdafruitDHT.py
et voici mon script
#!/usr/bin/python
# -*- coding: latin-1 -*-
# basé sur le script Adafruit et adapté pour Domoticz
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import os
import sys
import Adafruit_DHT
from requests.auth import HTTPBasicAuth
import requests
############# Parametres #################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# les parametres de Domoticz
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
domoticz_ip='10.192.17.104'
domoticz_port='8080'
user='pi'
password='********'
domoticz_idx=2
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# les parametres du DHT
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# sensor est 11,22,ou 2302
# pin est le numero d la pin que vous avez cablée
sensor=2302
pin=18
############# Fin des parametres #################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# le fomat pour la temp hum est celui ci
/json.htm?type=command¶m=udevice&idx=IDX&nvalue=0&svalue=TEMP;HUM;HUM_STAT
def maj_widget(val_url):
requete='http://'+domoticz_ip+':'+domoticz_port+val_url
#print requete
r=requests.get(requete,auth=HTTPBasicAuth(user,password))
if r.status_code != 200:
print "Erreur API Domoticz"
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
if humidity is not None and temperature is not None:
print('Temp={0:0.1f}* Humidity={1:0.1f}%'.format(temperature, humidity))
# l URL Domoticz pour le widget virtuel
url='/json.htm?type=command¶m=udevice&idx='+str(domoticz_idx)
url+='&nvalue=0&svalue='
url+=str('{0:0.1f};{1:0.1f};2').format(temperature, humidity)
#print url
maj_widget(url)
else:
print('Probleme avec la lecture du DHT. Try again!')
sys.exit(1)
et dans CRONTAB
j'ai bien mit l"execution au 5 Minutes pour ne pas a avoir a attendre présentement
plus tard je vais le mettre a 10 minutes par la suite
# mettre à la fin du fichier exécution du script au 5 minutes:
*/5 * * * * /home/pi/Adafruit_Python_DHT/examples/AdafruitDHT.py
Merci a vous tous si vous pouvez me dire ou est mon légendaire problème je crois bien
Luc
je repris a partir du début avec ma micro carte SD
et j'arrive pas a avoir les résultas sur la page DOMOTICZ
voici des info pour mieux trouver mon problème et comprendre pourquoi aussi:
Sur ma page Domoticz j'ai 50% avec 0 Celsius pour mon AM 2302
je les branché sur la pin 18 du Raspberry Pi soit le GPIO 24
J'execute un fonction pour savoir si mon AM2302 est bien branché et voici la réponse que je reçois sur une page WEB
http://10.192.17.104:8080/json.htm?type=devices&ridx=2
{
"ActTime" : 1566507843,
"app_version" : "4.10717",
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "24.2 C",
"Description" : "",
"Favorite" : 1,
"HardwareID" : 2,
"HardwareName" : "18B20",
"HardwareType" : "1-Wire (System)",
"HardwareTypeVal" : 12,
"HaveTimeout" : false,
"ID" : "AAAF",
"LastUpdate" : "2019-08-22 17:00:39",
"Name" : "Temp TS2000",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" : [ 0 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "LaCrosse TX3",
"Temp" : 24.199999999999999,
"Timers" : "false",
"Type" : "Temp",
"TypeImg" : "temperature",
"Unit" : 175,
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "1",
"trend" : 1
},
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "0.0 C, 50 %",
"Description" : "",
"DewPoint" : "-9.20",
"Favorite" : 1,
"HardwareID" : 3,
"HardwareName" : "DHT",
"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
"HardwareTypeVal" : 15,
"HaveTimeout" : false,
"Humidity" : 50,
"HumidityStatus" : "Comfortable",
"ID" : "14052",
"LastUpdate" : "2019-08-22 16:27:41",
"Name" : "DHT",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" : [ 0 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "THGN122/123/132, THGR122/228/238/268",
"Temp" : 0.0,
"Timers" : "false",
"Type" : "Temp + Humidity",
"TypeImg" : "temperature",
"Unit" : 1,
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "2",
"trend" : 0
}
],
"status" : "OK",
"title" : "Devices"
}
et Voici mon script qui est dans
/home/pi/Adafruit_Python_DHT/examples/AdafruitDHT.py
et voici mon script
#!/usr/bin/python
# -*- coding: latin-1 -*-
# basé sur le script Adafruit et adapté pour Domoticz
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import os
import sys
import Adafruit_DHT
from requests.auth import HTTPBasicAuth
import requests
############# Parametres #################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# les parametres de Domoticz
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
domoticz_ip='10.192.17.104'
domoticz_port='8080'
user='pi'
password='********'
domoticz_idx=2
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# les parametres du DHT
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# sensor est 11,22,ou 2302
# pin est le numero d la pin que vous avez cablée
sensor=2302
pin=18
############# Fin des parametres #################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# le fomat pour la temp hum est celui ci
/json.htm?type=command¶m=udevice&idx=IDX&nvalue=0&svalue=TEMP;HUM;HUM_STAT
def maj_widget(val_url):
requete='http://'+domoticz_ip+':'+domoticz_port+val_url
#print requete
r=requests.get(requete,auth=HTTPBasicAuth(user,password))
if r.status_code != 200:
print "Erreur API Domoticz"
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
if humidity is not None and temperature is not None:
print('Temp={0:0.1f}* Humidity={1:0.1f}%'.format(temperature, humidity))
# l URL Domoticz pour le widget virtuel
url='/json.htm?type=command¶m=udevice&idx='+str(domoticz_idx)
url+='&nvalue=0&svalue='
url+=str('{0:0.1f};{1:0.1f};2').format(temperature, humidity)
#print url
maj_widget(url)
else:
print('Probleme avec la lecture du DHT. Try again!')
sys.exit(1)
et dans CRONTAB
j'ai bien mit l"execution au 5 Minutes pour ne pas a avoir a attendre présentement
plus tard je vais le mettre a 10 minutes par la suite
# mettre à la fin du fichier exécution du script au 5 minutes:
*/5 * * * * /home/pi/Adafruit_Python_DHT/examples/AdafruitDHT.py
Merci a vous tous si vous pouvez me dire ou est mon légendaire problème je crois bien
Luc
- Pièces jointes
-
- Capture d’écran, le 2019-08-22 à 17.12.01.png (283.83 Kio) Consulté 2286 fois
-
- Capture d’écran, le 2019-08-22 à 17.09.30.png (435.44 Kio) Consulté 2286 fois
Dernière modification par vil1driver le 23 août 2019, 00:05, modifié 1 fois.
Raison : Hide password
Raison : Hide password