problems with multiple sendtohttp - ack build?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
ensingg
Normal user
Posts: 26
Joined: 16 Jul 2017, 10:52

problems with multiple sendtohttp - ack build?

#1 Post by ensingg » 07 Apr 2020, 10:23

On one of my ESP8266 Wemos D1 I have the following rule.
But it seems like the SendToHTTP is not reliable. Allthough the WIFI connections are fine.
Sometimes all SendtoHTTP commands are executed/received, but a lot of times some of them are not.
What can I do ?

At the moment I am using "ESP_Easy_mega-20191208_normal_ESP8266_4M1M.bin"

I read about the ACK function in new builds. Could this help?

Code: Select all

if [Magneetsw#switch] = 1
      SendToHTTP www.pushsafer.com,80,"/api?k=xxxxxxxxxxxxxxxxxx&t=Ehek&m=Het%20elektrisch%20hek%gaat%open!!&d=a&s=3&pr=2"
      SendToHTTP 192.168.0.102,8181,"/json.htm?type=command&param=udevice&idx=2197&nval10ue=0&svalue=c:/mp3/pushsafer/0003.mp3"
      SendToHTTP 192.168.0.102,8181,"/json.htm?type=command&param=switchlight&idx=1028&switchcmd=On"
      SendToHTTP 192.168.0.36,80,"/control?cmd=play,0003"
      SendToHTTP 192.168.0.15,80,"/control?cmd=event,DeurbelBeverlyHIllsCop"
      SendToHTTP 192.168.0.29,80,"/control?cmd=event,LampAan15min"
      SendToHTTP 192.168.0.35,80,"/control?cmd=event,lpaan"
      SendToHTTP 192.168.0.43,80,"/control?cmd=event,aan"
Endif

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

Re: problems with multiple sendtohttp - ack build?

#2 Post by TD-er » 07 Apr 2020, 10:42

I think running so many SendToHTTP calls in one blocking call is causing side effects which may prevent new attempts.

Not sure if it was already present in the December builds, but the latest builds do have "SendToHTTP wait for ack" on the Tools => Advanced page (Rules Settings)
If you check this, it will wait for a reply before returning.
This will make the block of so many SendToHTTP calls take even longer to process (and thus block other operations on the ESP), but it will probably help with your issue.

ensingg
Normal user
Posts: 26
Joined: 16 Jul 2017, 10:52

Re: problems with multiple sendtohttp - ack build?

#3 Post by ensingg » 07 Apr 2020, 10:47

The side effect of the ACK worries me too.
Are there better solutions.

At start I let domoticz handle this. But I thought that letting my ESP8266 do it directly would be more reliable.

Will events help in this?

ensingg
Normal user
Posts: 26
Joined: 16 Jul 2017, 10:52

Re: problems with multiple sendtohttp - ack build?

#4 Post by ensingg » 07 Apr 2020, 10:49

The last time I looked at the logging when the event triggers showed me all the ACT and COMMANDs for all the SendToHTTP
But after that a HTTP: C001 connection failed (29/0) and a HTTP : C001 connection failed (30/0)

ensingg
Normal user
Posts: 26
Joined: 16 Jul 2017, 10:52

Re: problems with multiple sendtohttp - ack build?

#5 Post by ensingg » 07 Apr 2020, 10:52

How is the reilability of the data sent to the domoticz controller?
Is it better to let domoticz handle my http requests?

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

Re: problems with multiple sendtohttp - ack build?

#6 Post by TD-er » 07 Apr 2020, 11:58

ensingg wrote: 07 Apr 2020, 10:52 How is the reilability of the data sent to the domoticz controller?
Is it better to let domoticz handle my http requests?
The Domoticz HTTP controller does only send simple GET requests which are answered almost immediately.
Domoticz MQTT controller does send the messages to the MQTT broker and the used MQTT client does keep an open connection, which makes it way more responsive.

The server running Domoticz does have a lot more resources to handle multiple HTTP requests.
My assumption is that the IP stack requires the received reply must be read first before a new request can be made.
After some timeout the unread reply is discarded and that connection is no longer considered active.
But there is only a limited number of slots available for active connections.
So when sending multiple requests in a short period of time you will probably fill up the available active connections.

By waiting for the acknowledgement, you will wait for a reply.
Problem is when the server does not give a reply.... (either down or maybe not built in the protocol to reply)
Then the execution of this rules section will block execution of all other jobs on the ESP.

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

Re: problems with multiple sendtohttp - ack build?

#7 Post by Ath » 07 Apr 2020, 13:29

Sending cmd's to multiple esp's could also be achieved by using the udp networking feature of the esp's involved.
I assign them the last part of the dhcp-fixed ip as unitnumber, then use the SendTo command to trigger an action like this:

Code: Select all

  SendTo,53,'event,DoorChimeStart'
You can build separate udp networks if desired, by choosing a different port.
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests