My problem with SendToHTTP

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
uriukti
New user
Posts: 5
Joined: 05 Sep 2020, 16:02

My problem with SendToHTTP

#1 Post by uriukti » 05 Sep 2020, 16:18

Hello to all!
I have a seemingly simple task, but I don't understand how to do it, because I'm just learning how to do it.
I have a router connected to a ddns server and my computer can automatically update the page in the browser with an address like
http://blabla.bla/update/SGJJ5GJJGXH4JHCHHV etc. Then ddns at this address performs a check and, if necessary, a new IP correction.
My ISP sometimes changes the external IP for me. And then the ddns service always knows the external IP. But.
How can I do such an update without a computer directly from Esp Easy on the module? I've tried a lot and haven't worked yet. Where and how can I ask the esp module to open this page with this address? Thanks to those who answered.

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

Re: My problem with SendToHTTP

#2 Post by TD-er » 05 Sep 2020, 16:53

I'm not sure if you need to also supply the public IP yourself.
It would be a bit redundant as it is probably connecting from your public IP, right?

One thing you probably also need to enable for this is the "SendToHTTP wait for ack" on Tools -> advanced.

You may need to run this SendToHTTP from the rules, periodically, so you need to enable the rules.
Not sure what the best interval is for it, that's up to you to find out :)

See the docs for some examples: https://espeasy.readthedocs.io/en/lates ... sendtohttp

uriukti
New user
Posts: 5
Joined: 05 Sep 2020, 16:02

Re: My problem with SendToHTTP

#3 Post by uriukti » 05 Sep 2020, 19:43

Hi TD-er!
Yes. Now I realize that I really forgot to give some details. My ddns provider told me to update myself. This is done by going to a unique address, a link that is assigned to the user. Alas, clients are not automatically updated on their server. IP update for the user occurs if you regularly update this link in the browser. Then my new IP is registered on the ddns server. Update time 5 minutes. I configured my computer to automatically request, following this link. Every 5 minutes.
I have rules enabled in Esp Easy and a separate ask for SentToHTTP.
I tried different options with timers and Clock, but for some reason nothing works. I'm pretty sure there is a syntax error. I didn't understand it.

I do it about:

On Rules#Timer=1 do
SendToHTTP http://blabla.bla/update/SGJJ5GJJGXH4JHCHHV,80,
loopTimerSet,1,362
endon

I think..
May be is it not right?

uriukti
New user
Posts: 5
Joined: 05 Sep 2020, 16:02

Re: My problem with SendToHTTP

#4 Post by uriukti » 05 Sep 2020, 19:51

I read a lot of help and looked at examples. As a result, I got completely confused.

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

Re: My problem with SendToHTTP

#5 Post by Ath » 05 Sep 2020, 22:39

Possibly, adding quotes around the entire url and extra arguments including the commas, (either single or double, doesn't matter) might help here, as ESPEasy is a bit picky on the number of arguments (comma or space separated) supplied to a command.

That would end up like this: (also corrected the error with loopTimerSet)

Code: Select all

on Wifi#Connected do
  loopTimerSet,1,360  // Update every 6 minutes
endon

On Rules#Timer=1 do
  SendToHTTP "http://blabla.bla/update/SGJJ5GJJGXH4JHCHHV,80,"
endon
/Ton (PayPal.me)

uriukti
New user
Posts: 5
Joined: 05 Sep 2020, 16:02

Re: My problem with SendToHTTP

#6 Post by uriukti » 06 Sep 2020, 09:11

Dear friends.
I will now try different options taking into account your advice and corrections. I'll write later whether it worked or not. I am not lost. Test time. )
Thank you very much for your participation.

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

Re: My problem with SendToHTTP

#7 Post by TD-er » 06 Sep 2020, 11:57

The arguments for sendToHttp are incorrect.
See: https://espeasy.readthedocs.io/en/lates ... sendtohttp


Code: Select all

on Wifi#Connected do
  loopTimerSet,1,360  // Update every 6 minutes
endon

On Rules#Timer=1 do
  SendToHTTP,blabla.bla,80,"update/SGJJ5GJJGXH4JHCHHV"
endon
Parameters are:
- host
- port
- rest of URL after the host:port

uriukti
New user
Posts: 5
Joined: 05 Sep 2020, 16:02

Re: My problem with SendToHTTP

#8 Post by uriukti » 06 Sep 2020, 15:02

Dear good people. Everything worked out. Yes. The syntax was not correct. The last example you proposed has worked stably for me. The one who suggested TD-er. Only works for me without quotes. Thank. The problem has been resolved. Will be a good example for everyone who looks here later. And you guys, happiness and warm sun!

Post Reply

Who is online

Users browsing this forum: No registered users and 86 guests