Send HTTP request using Rules

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
MikeBZH44
New user
Posts: 3
Joined: 24 Apr 2022, 15:42

Send HTTP request using Rules

#1 Post by MikeBZH44 » 24 Apr 2022, 16:04

Hello

I'm running ESP_Easy_mega_20220328_normal_ESP8266_4M1M on Wemos D1 mini

I'm reading a DS18B20 temperature sensor and I can see temperature change when I heat or cool the sensor.

But now I want to send HTTP request when the temperature is over or above a limit.

So I have enable Rules and I made this one :

Code: Select all

on [TempECS#temperature] do
   if [TempECS#temperature]>30
      //Bascule sur OFF le module S1
      SendToHTTP <IPaddress>,8083,/core/api/jeeApi.php?apikey=<MyJeedomAPIKey>&type=cmd&id=1663
   endif
   if [TempECS#temperature]<25
      //Bascule sur ON le module S1
      SendToHTTP <IPaddress>,8083,/core/api/jeeApi.php?apikey=<MyJeedomAPIKey>&type=cmd&id=1664
   endif
endon
The device for reading the DS18B20 is named TempECS and the value is named temperature :

Image

But When I blow on the sensor to make the temperature rise above 30°, the HTTP request is not sent.

I also try whith a much more simple rule :

Code: Select all

on [System#Wake] do
   SendToHTTP <IPaddress>,8083,/core/api/jeeApi.php?apikey=<MyJeedomAPIKey>&type=cmd&id=1664
endon
But nothing happen

Where is my mistake ?

Thank for your help.

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Send HTTP request using Rules

#2 Post by Ath » 24 Apr 2022, 16:20

In the event-name you should not use the square brackets, in variable replacement (any where else) you should, so changing to this:

Code: Select all

on system#wake do
...
endon
and

Code: Select all

on TempECS#temperature do
...
endon
will make it work.
/Ton (PayPal.me)

MikeBZH44
New user
Posts: 3
Joined: 24 Apr 2022, 15:42

Re: Send HTTP request using Rules

#3 Post by MikeBZH44 » 24 Apr 2022, 17:34

Yes !! Thanks a lot !!!

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Send HTTP request using Rules

#4 Post by TD-er » 24 Apr 2022, 20:39

Also during system#wake, you probably don't have a network connection yet.
So better to act on the WiFi#connected event.

MikeBZH44
New user
Posts: 3
Joined: 24 Apr 2022, 15:42

Re: Send HTTP request using Rules

#5 Post by MikeBZH44 » 24 Apr 2022, 20:59

that's right ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests