m (Disisid a déplacé la page ESP3 DHT22 IFTTT vers ESP32 DHT22 IFTTT) |
|||
(4 révisions intermédiaires par le même utilisateur non affichées) | |||
Ligne 74 : | Ligne 74 : | ||
Otherwise, click the '''connect''' button and follow the steps on their website to create a webhooks account</translate> | Otherwise, click the '''connect''' button and follow the steps on their website to create a webhooks account</translate> | ||
− | |Step_Picture_00= | + | |Step_Picture_00=ESP3_DHT22_IFTTT_Send_Notifications_from_ESP32_to_sheets_with_IFTTT___GPIO_CC_Learning.png |
}} | }} | ||
{{Tuto Step | {{Tuto Step | ||
Ligne 129 : | Ligne 129 : | ||
|Step_Title=<translate>Get API key</translate> | |Step_Title=<translate>Get API key</translate> | ||
|Step_Content=<translate>Select the '''Webhooks''' icon on the finished page</translate> | |Step_Content=<translate>Select the '''Webhooks''' icon on the finished page</translate> | ||
− | |Step_Picture_00= | + | |Step_Picture_00=ESP3_DHT22_IFTTT_If_Maker_Event__esp32___then_Add_row_to_gmail_com_s.png |
}} | }} | ||
{{Tuto Step | {{Tuto Step | ||
Ligne 187 : | Ligne 187 : | ||
</syntaxhighlight><br /></translate> | </syntaxhighlight><br /></translate> | ||
− | |Step_Picture_00= | + | |Step_Picture_00=ESP3_DHT22_IFTTT_Thonny__-___UsersDHT22_Code_public_py_____13___6.png |
}} | }} | ||
{{Tuto Step | {{Tuto Step | ||
Ligne 203 : | Ligne 203 : | ||
}} | }} | ||
{{Tuto Status | {{Tuto Status | ||
− | |Complete= | + | |Complete=Published |
}} | }} |
Auteur Sid | Dernière modification 15/01/2023 par Disisid
ESP32___DHT22___IFTTT_306268167_427924746149632_7414040424516888266_n.jpg Creation
You will need a Python IDE such as Thonny for this project. You can use any IDE, but for this project, we are using Thonny. To install and use Thonny:
This is how your circuit should look like. You will need the ESP32 microcontroller, DHT22 temp/humidity module, breadboard and jumper wires.
Go to https://ifttt.com/join
Sign up and create an account using the appropriate options
Once you are on "choose a service", type in Webhooks in the search bar and click Webhooks
- If you already have a webhooks account, skip this step
Otherwise, click the connect button and follow the steps on their website to create a webhooks account
Name the event for the trigger esp32 (it is case sensitive so be careful)
Select all the values you want returned to the spreadsheet, along with the path the sheet has to follow in your drive.
For this project, we are returning Temperature and Humidity values from the DHT22, so we will select Value1 and Value2
Once you have finished all the previous steps, hit continue on the applet page
Once you get onto this page, copy the api key and URL to paste into the code in Thonny
import network
import urequests as requests
from machine import Pin
from dht import DHT22
from time import sleep
#Replace the values below with the correct WIFI SSID and Password
wifi_ssid = "WIFI NAME"
wifi_password = "WIFI PASS"
#This is the webhook URL with API Key from IFTTT
webhook_url = "https://maker.ifttt.com/trigger/esp32/with/key/<insert api key here>"
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
if sta_if.isconnected() == False:
sta_if.connect(wifi_ssid, wifi_password)
while sta_if.isconnected() == False:
#sta_if = network.WLAN(network.STA_IF)
#sta_if.active(True)
#sta_if.connect(wifi_ssid, wifi_password)
sleep(1)
print(".", end = "")
dht22 = DHT22(Pin(15))
while True:
dht22.measure()
temperature = dht22.temperature()
humidity = dht22.humidity()
temp = temperature * 9/5 + 32
url = webhook_url + "?value1=" + str(temp) + " F" + "&value2=" + str(humidity) + "%"
try:
r = requests.get(url)
print(r.text)
except Exception as e:
print(e, "error")
sleep(30)
en none 0 Published
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #