Problem with SendToHTTP

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
HermannDerUser
Normal user
Posts: 8
Joined: 20 Feb 2019, 10:05

Problem with SendToHTTP

#1 Post by HermannDerUser » 20 Feb 2019, 10:28

Hello together,
I'm new with the ESPeasy and have a problem with the SendToHTTP command. At the moment I use 'ESP_Easy_mega-20190212_normal_ESP8266_1024' on a Sonoff basic. In the rules tab I create a rule like this:

Code: Select all

on Intern#Taster do
 if [Intern#Taster]=3                             // bei Doppelklick
    SendToHTTP 192.168.69.202,80,/?relais=2
    Pulse,13,0,100                                // 3x kurz blinken
    Pulse,13,1,100
    Pulse,13,0,100
    Pulse,13,1,100
    Pulse,13,0,100
    Pulse,13,1,100                             
    endif
endon
and its work well. But if I change the SentToHTTP command to

Code: Select all

SendToHTTP 192.168.69.15,80,/api/device/fsb/buttonPressed?buttonId=fs
nothing happens. The command push a button over the API from pimatic. If I enter the command

Code: Select all

http://192.168.69.15:80/api/device/fsb/buttonPressed?buttonId=fs
in the address line of my browser, it works well.

User avatar
grovkillen
Core team member
Posts: 3324
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Problem with SendToHTTP

#2 Post by grovkillen » 20 Feb 2019, 11:56

What does the log state when your rule is executed?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

HermannDerUser
Normal user
Posts: 8
Joined: 20 Feb 2019, 10:05

Re: Problem with SendToHTTP

#3 Post by HermannDerUser » 20 Feb 2019, 13:30

Here the log with loglevel "debug":

Code: Select all

15039519: EVENT: Clock#Time=Wed,13:24
15039549: EVENT: Clock#Time=Wed,13:24 Processing time:30 milliSeconds
15044532: SendToHTTP 192.168.69.15,80,/api/device/fsb/buttonPressed?buttonId=fs
15044532: SendToHTTP: Host: 192.168.69.15 port: 80
15044533: SendToHTTP: Path: /api/device/fsb/buttonPressed?buttonId=fs
15044548: GET /api/device/fsb/buttonPressed?buttonId=fs HTTP/1.1^^Host: 192.168.69.15^^User-Agent: ESP Easy/20103/Feb 12 2019 03:11:27^^C
15044549: GET /api/device/fsb/buttonPressed?buttonId=fs HTTP/1.1^^Host: 192.168.69.15^^User-Agent: ESP Easy/20103/Feb 12 2019 03:11:27^^C
15044551: HTTP : Command_HTTP_SendToHTTP written to client (147/147)
15044551: HTTP : Command_HTTP_SendToHTTP closing connection
15044591: Lev.2: [if 1=1]=true
15044593: ACT  : Pulse,13,1,100
15044697: SW   : GPIO 13 Pulsed for 100 mS
15044702: ACT  : Pulse,13,0,100
15044805: SW   : GPIO 13 Pulsed for 100 mS
15044809: ACT  : Pulse,13,1,100
15044912: SW   : GPIO 13 Pulsed for 100 mS
15044959: ACT  : Pulse,13,0,100
15045063: SW   : GPIO 13 Pulsed for 100 mS
15045067: ACT  : Pulse,13,1,100
15045170: SW   : GPIO 13 Pulsed for 100 mS
15045174: ACT  : Pulse,13,0,100
15045277: SW   : GPIO 13 Pulsed for 100 mS
15045281: Lev.2: [else]=false
15045331: Lev.1: [if 3=11]=false
15045375: EVENT: Intern#Taster=3.00 Processing time:893 milliSeconds
15045379: SW  : GPIO=13 State=1 Output value=1
15045387: EVENT: LED#LED=1.00
15045420: EVENT: LED#LED=1.00 Processing time:33 milliSeconds
When I type the command into the tools->command field I get: ok; but nothing happens too

User avatar
iron
Normal user
Posts: 86
Joined: 24 Sep 2016, 08:37
Location: Veria, Greece
Contact:

Re: Problem with SendToHTTP

#4 Post by iron » 20 Feb 2019, 14:37

SendToHTTP,url.com,80,/xyz is the syntax

you have space instead of coma after SendToHTTP

-D
-D

HermannDerUser
Normal user
Posts: 8
Joined: 20 Feb 2019, 10:05

Re: Problem with SendToHTTP

#5 Post by HermannDerUser » 20 Feb 2019, 14:51

Now I try with comma, but that doesn't work either. On the other hand, the command

Code: Select all

SendToHTTP 192.168.69.202,80,/?relais=2
works with the space perfect. :?:

User avatar
grovkillen
Core team member
Posts: 3324
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Problem with SendToHTTP

#6 Post by grovkillen » 20 Feb 2019, 15:16

Regarding spaces, we allowed them before but not officially anymore.

BUT most likely only the first space will work in future builds.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

HermannDerUser
Normal user
Posts: 8
Joined: 20 Feb 2019, 10:05

Re: Problem with SendToHTTP

#7 Post by HermannDerUser » 20 Feb 2019, 15:32

Okay, I switched from space to comma, but...
...it's still not working.

Does anyone have any idea why this command doesn't work?

User avatar
grovkillen
Core team member
Posts: 3324
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Problem with SendToHTTP

#8 Post by grovkillen » 20 Feb 2019, 17:27

Use something like "wireshark" or "fiddle" to see what headers is being sent by the ESP Easy unit. Your receiving end might want something that the ESP isn't sending?

What is on the receiving end?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

HermannDerUser
Normal user
Posts: 8
Joined: 20 Feb 2019, 10:05

Re: Problem with SendToHTTP

#9 Post by HermannDerUser » 20 Feb 2019, 18:56

hi,

I just tried to execute the command via the browser on another computer. I noticed that a user/password query is prompted. Is it possible to specify a user/password for the SentToHTTP command.

User avatar
grovkillen
Core team member
Posts: 3324
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Problem with SendToHTTP

#10 Post by grovkillen » 20 Feb 2019, 19:07

Topically you do it like this:

http://USERNAME:PASSWORD@domain.com...
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

HermannDerUser
Normal user
Posts: 8
Joined: 20 Feb 2019, 10:05

Re: Problem with SendToHTTP

#11 Post by HermannDerUser » 20 Feb 2019, 19:22

I adjusted my rule. In the log file I now find the following entries:

Code: Select all

1695435: SendToHTTP user:Password@192.168.69.15,80,/api/device/fsb/buttonPressed?buttonId=fs
1695436: SendToHTTP: Host: user:password@192.168.69.15 port: 80
1695436: SendToHTTP: Path: /api/device/fsb/buttonPressed?buttonId=fs
My password is case-sensitive but in the HTTP request everything is lower case.
How can I change that?

User avatar
grovkillen
Core team member
Posts: 3324
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Problem with SendToHTTP

#12 Post by grovkillen » 20 Feb 2019, 19:26

That is probably not possible right now (all commands are set to lower case). You need to open a feature request for that... Sorry.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
grovkillen
Core team member
Posts: 3324
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Problem with SendToHTTP

#13 Post by grovkillen » 20 Feb 2019, 19:30

As suggested by TD-er (on slack):

"user:pAsSwRd@host:port"

So, that is double quotes on each side...
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

HermannDerUser
Normal user
Posts: 8
Joined: 20 Feb 2019, 10:05

Re: Problem with SendToHTTP

#14 Post by HermannDerUser » 20 Feb 2019, 19:45

Thank you very much for the prompt reply, but it doesn't work. I tried

Code: Select all

SendToHTTP "user:Password@192.168.69.15",80,/api/device/fsb/buttonPressed?buttonId=fs

Code: Select all

SendToHTTP "user:Password@192.168.69.15,80",/api/device/fsb/buttonPressed?buttonId=fs

Code: Select all

SendToHTTP 'user:Password@192.168.69.15',80,/api/device/fsb/buttonPressed?buttonId=fs

Code: Select all

SendToHTTP 'user:Password@192.168.69.15,80',/api/device/fsb/buttonPressed?buttonId=fs
but the log said for the first example:

Code: Select all

3391935: SendToHTTP 'user:Password@192.168.69.15',80,/api/device/fsb/buttonPressed?buttonId=fs
3391936: SendToHTTP: Host: user:password@192.168.69.15 port: 80
3391937: SendToHTTP: Path: /api/device/fsb/buttonPressed?buttonId=fs

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

Re: Problem with SendToHTTP

#15 Post by TD-er » 20 Feb 2019, 19:54

I guess it is a bug then.
The parsing of the rules is a bit too complicated every now and then.
Comparing commands is done case-insensitive, but the parameters should be sent case sensitive.
Or else strings sent to a display for example can not have a mix of lower and upper case letters.

HermannDerUser
Normal user
Posts: 8
Joined: 20 Feb 2019, 10:05

Re: Problem with SendToHTTP

#16 Post by HermannDerUser » 20 Feb 2019, 20:09

Thanks for the help, then I will temporarily change my password for testing.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 12 guests