SendToHttp Raw-Message

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

SendToHttp Raw-Message

#1 Post by jo485 » 02 Oct 2020, 22:27

Hello,
is it possible to send a RAW-Message from an ESPEasy-Device to another ESP-Device without ESPEasy, using SendToHttp?

"http://192.168.1.137/set_ist?IstTemp=21" for sending a value is working from a Browser.

But sending from ESPEasy it doesn't work.

Any ideas?

Greetings

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

Re: SendToHttp Raw-Message

#2 Post by TD-er » 02 Oct 2020, 22:32

What syntax did you use?

Code: Select all

sendtohttp,192.168.1.137,80,/set_ist?IstTemp=21

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#3 Post by jo485 » 02 Oct 2020, 22:40

Here is a Logging info:

5218580: ACT : sendtohttp,192.168.1.137,80,/set_ist?IstTemp=21
5218582: Command: sendtohttp
5218692: ACT : timerSet,1,30
5218693: Command: timerSet

but nothing received.

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

Re: SendToHttp Raw-Message

#4 Post by TD-er » 02 Oct 2020, 22:46

Does the other end require login?

Can you also try to check "SendToHTTP wait for ack" on Tools->Advanced page?

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#5 Post by jo485 » 02 Oct 2020, 22:58

No login required.

I don't find "SendToHTTP wait for ack".

Is this Image to old? "ESP_Easy_mega-20191208_dev_ESP8266_4M1M.bin"

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

Re: SendToHttp Raw-Message

#6 Post by TD-er » 02 Oct 2020, 22:59

I think it is less than 10 months ago that I added this feature.

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#7 Post by jo485 » 02 Oct 2020, 23:20

Now i tried the newest release with the Option "SendToHTTP wait for ack" but it doesn't work.

By sending only the IP-Address the receiving Device had to answer, but no reaction.

The syntax above is ok?

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

Re: SendToHttp Raw-Message

#8 Post by TD-er » 03 Oct 2020, 12:19

Just a few checks you can do:
Is the IP you try to reach in the same subnet as your ESP?
Do you use DHCP or static IP on the ESP? If static, please check you have the correct configuration, like correct gateway (needed when you try to reach something not in your subnet), correct subnetmask (e.g. 255.255.255.0 )

As far as I can judge from your log, the syntax looks OK.

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#9 Post by jo485 » 03 Oct 2020, 12:27

Additional the ESPEasy-Device is connected to Fhem, and is working. Can this be possibly the problem?

All is in the same subnet, DHCP is used.

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

Re: SendToHttp Raw-Message

#10 Post by TD-er » 04 Oct 2020, 10:10

What other device is it where you want to connect to?

If you enable the debug log level you will see the actual request being sent. (given you have debug log level code included in the build, which isn't the case with "test" builds due to size restrictions)
This is only logged if the connection could be made to the other side.
As far as I can see in the code, there is (sadly) no other log indicating a failed connect.

So at least the command sendtohttp should also return a false state if it was not successful. (which it doesn't right now)

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

Re: SendToHttp Raw-Message

#11 Post by TD-er » 04 Oct 2020, 11:15


jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#12 Post by jo485 » 04 Oct 2020, 13:13

Unfortunately i have only esp8266 in use

I tested UDP, it dont work too. With the tool Packet Sender it works.

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

Re: SendToHttp Raw-Message

#13 Post by TD-er » 04 Oct 2020, 15:23

Sorry, made a copy/paste error.
Here's the ESP8266 build: https://www.dropbox.com/s/92maswz93cww1 ... 4.zip?dl=0

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#14 Post by jo485 » 04 Oct 2020, 18:18

Here is the error:

801437: Webserver args: 0: 'cmd' length: 47
805550: SendToHTTP connection failed

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

Re: SendToHttp Raw-Message

#15 Post by TD-er » 04 Oct 2020, 21:40

So it cannot make a connection to the other host.
Just make sure the port is correct and the rest of the URL.

You only showed what was logged, but can you also show (verbatim in code tags) the exact command you give?

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#16 Post by jo485 » 05 Oct 2020, 16:54

This is what i have in the rules Set:

On Rules#Timer=1 do
SendToHTTP 192.168.1.137,80,/set_ist?IstTemp=21
timerSet,1,30
endon

Port is the same in the other device, and the command is working from a Browser.

or only this line in Tools/Command:

" SendToHTTP 192.168.1.137,80,/set_ist?IstTemp=21"

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

Re: SendToHttp Raw-Message

#17 Post by Ath » 05 Oct 2020, 17:05

jo485 wrote: 05 Oct 2020, 16:54 or only this line in Tools/Command:

" SendToHTTP 192.168.1.137,80,/set_ist?IstTemp=21"
Can you show the log (please include a line before and after, and any lines inbetween the cmd and sendtohttp lines) when sending it from the tools page (then it is working, as I read from your comment)?

Does it change if you copy the SendToHTTP command from the rules to your tools page and execute it?
/Ton (PayPal.me)

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#18 Post by jo485 » 05 Oct 2020, 18:01

No, both don't work.

this is the logoutput:

5599211: Webserver args: 0: 'cmd' length: 54
5599220: Command: SendToHTTP
5599221: SendToHTTP: Host: http://192.168.1.137 port: 80
5603362: SendToHTTP connection failed

if i send this:

" SendToHTTP 192.168.1.137,80,/set_ist?IstTemp=21"

from the tools-page.

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

Re: SendToHttp Raw-Message

#19 Post by Ath » 05 Oct 2020, 19:42

Does your receiving ESP use ip filtering, just like ESPEasy (see Hardware tab)? and if so, is the sending ESP in the allowed range?
It looks much like the ESP's can't or won't see each other on the network. That includes having the sending ESP on a separate 'IoT' or guest network, that your router may not allow to access other segments of your network.
/Ton (PayPal.me)

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#20 Post by jo485 » 05 Oct 2020, 20:31

All ESPs are in the same network. Ping from PC is ok for all devices.

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

Re: SendToHttp Raw-Message

#21 Post by TD-er » 05 Oct 2020, 20:54

Ath wrote: 05 Oct 2020, 19:42 Does your receiving ESP use ip filtering, just like ESPEasy (see Hardware tab)? and if so, is the sending ESP in the allowed range?
[...]
IP-filtering is only for access to the web interface.

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

Re: SendToHttp Raw-Message

#22 Post by TD-er » 05 Oct 2020, 20:58

Please show the network related part of the sysinfo page.
Just to be sure we're not missing something here.

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#23 Post by jo485 » 05 Oct 2020, 21:02

Here it is:

Wifi: 802.11N (RSSI -44 dB)
IP Config: DHCP
IP / Subnet: 192.168.1.132 / 255.255.255.0
Gateway: 192.168.1.5
Client IP: 192.168.1.2
DNS: 192.168.1.5 / (IP unset)
Allowed IP Range: 192.168.1.0 - 192.168.1.255
STA MAC: EC:FA:BC:9B:E8:4D
AP MAC: EE:FA:BC:9B:E8:4D
SSID: X-NET-X (38:10:D5:D5:B0:8F)
Channel: 11
Connected: 4h37m
Last Disconnect Reason: (1) Unspecified
Number Reconnects: 0

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#24 Post by jo485 » 07 Oct 2020, 20:30

Meanwhile i tried to check the packets with Wireshark.
I didn't get packets from the sending device by using the SendToHttp-command as shown above, but packets to fhem are shown.
As i see, the device doesn't send the command.
Can anybody confirm that the command is working?

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

Re: SendToHttp Raw-Message

#25 Post by Ath » 08 Oct 2020, 21:18

Is the receiving ESP by any chance using https as the protocol? Because your browser does connect, but most browsers nearly automatically use https.
ESPEasy doesn't support https (because of memory, flash-size and CPU restrictions), but a specific, maybe single function, ESP software can use https.
/Ton (PayPal.me)

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#26 Post by jo485 » 09 Oct 2020, 17:20

It's no https. Here are the most important parts from the WIFI-Settings of the receiving-device-sketch.
It should be all that i need:

#include <ESP8266WiFi.h>
#include <WiFiUDP.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266HTTPUpdateServer.h>

IPAddress ip(192, 168, 1, 137);
IPAddress gateway(192, 168, 1, 5);
IPAddress subnet(255, 255, 255, 0);
ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater;
WiFiUDP UDP;
WiFi.mode(WIFI_STA);
WiFi.hostname("Test");
WiFi.config(ip, gateway, subnet);
WiFi.begin(ssid, password);
UDP.begin(UDP_PORT);
httpUpdater.setup(&httpServer);
httpServer.begin();
MDNS.addService("http", "tcp", 80);
httpServer.on("/", handleRoot);

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#27 Post by jo485 » 13 Oct 2020, 20:54

Problem is solved:
Checkbox in my Fritzbox: "Die unten angezeigten aktiven WLAN-Geräte dürfen untereinander kommunizieren" marked, then it works.

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

Re: SendToHttp Raw-Message

#28 Post by TD-er » 13 Oct 2020, 23:07

That's for the guest network?
I've not seen that option in the normal WiFi.. when I still had a Fritzbox router.

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

Re: SendToHttp Raw-Message

#29 Post by iron » 14 Oct 2020, 14:30

TD-er wrote: 13 Oct 2020, 23:07 That's for the guest network?
I've not seen that option in the normal WiFi.. when I still had a Fritzbox router.
It is widely known as a client-to-client-isolation at the AP level on most WiFi devices

But the http request shall return via the gateway so it should work anyways unless there is no other routing rule enabled at that level.

-D
-D

jo485
Normal user
Posts: 17
Joined: 02 Oct 2020, 22:08

Re: SendToHttp Raw-Message

#30 Post by jo485 » 14 Oct 2020, 16:34

It's in WLAN/Sicherheit/Verschlüsselung FB7490 FW7.21

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 20 guests