sendtohttp acknowledgement for rules
Moderators: grovkillen, Stuntteam, TD-er
sendtohttp acknowledgement for rules
Hi,
does anyone know if there is some kind of acknowledgement to sendtohttp i could use for rules?
eg:
on succesfull sendtohttp do
It´s for my battery powered sensor project. i would like to send the esp to sleep immediately after a succesfull sendtohttp
does anyone know if there is some kind of acknowledgement to sendtohttp i could use for rules?
eg:
on succesfull sendtohttp do
It´s for my battery powered sensor project. i would like to send the esp to sleep immediately after a succesfull sendtohttp
Re: sendtohttp acknowledgement for rules
I do like your idea, but currently that's not supported.
It inspires me to create a PR for that
Will be applicable to some other commands as well, just thinking if there should be a success / fail event, or just pass the HTTP status code returned.
It inspires me to create a PR for that
Will be applicable to some other commands as well, just thinking if there should be a success / fail event, or just pass the HTTP status code returned.
/Ton (PayPal.me)
Re: sendtohttp acknowledgement for rules
after many trial and error i ended up with this code and the last part would be a perfect fit for it
i could minimize the on-time without fiddling with the timings
depending on the router i have 1-2 seconds on-time. but still sometimes missing data (its seldom but annoying)
Code: Select all
On System#Boot do
TaskRun,1
TimerSet_ms,1,10
Endon
On System#Wake do
TaskRun,1
Endon
On WiFi#Connected do
Let,1,1
Endon
On sensor_extern#Temperature do
Let,2,1
Endon
On Rules#Timer=1 do
If [var#1]=1 and [var#2]=1
SendToHTTP whatever you want
Let,1,0
Endif
TimerSet_ms,1,10
Endon
///----would be a nice extra------
On successfull sendtohttp do
If [Switch#State]=0
deepsleep,600
Endif
Endon
depending on the router i have 1-2 seconds on-time. but still sometimes missing data (its seldom but annoying)
Re: sendtohttp acknowledgement for rules
There is a checkbox for it on the Tools->Advanced page.
Top of that page: SendToHTTP wait for ack
Top of that page: SendToHTTP wait for ack
Re: sendtohttp acknowledgement for rules
In addition to the 'wait for ack' setting, I would want to suggest something like this:
Code: Select all
///----would be a nice extra------
On sendtohttp#status do // eventvalue1 = http status code, optional: eventvalue2 1 = success, 0 = fail
If %eventvalue1% >= 200 and %eventvalue1% < 400
If [Switch#State]=0
deepsleep,600
Endif
Else
// Fail catastrophically ?
Endif
Endon
/Ton (PayPal.me)
Re: sendtohttp acknowledgement for rules
Thats right but not the issue.
Timing is.
I want the on-time as short a possible and if the wifi connection takes longer on wake up, the esp goes to sleep before it can issue the sendtohttp command.
To circumvent that i would like to send the esp to sleep manually and directly after a successful sendtohttp as you can see in the end of the code i send in the last post...
Last edited by chromo23 on 20 Apr 2021, 13:10, edited 1 time in total.
Re: sendtohttp acknowledgement for rules
@Ath looks good!
that the esp doesn’t stay awake forever i would send it back to sleep after some further attempts
Code: Select all
///----would be a nice extra------
On sendtohttp#status do // eventvalue1 = http status code, optional: eventvalue2 1 = success, 0 = fail
If %eventvalue1% >= 200 and %eventvalue1% < 400
If [Switch#State]=0
deepsleep,600
Endif
Else
//try to send it 2 or 3 more times and then go to sleep
Endif
Endon
Re: sendtohttp acknowledgement for rules
Just realize this is a feature proposal from Ton, not yet working code.
Who is online
Users browsing this forum: Ahrefs [Bot] and 109 guests