use of sendto , sendtoudp or sendtohttp

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
lumajo
Normal user
Posts: 20
Joined: 03 Feb 2018, 13:19
Location: Munich

use of sendto , sendtoudp or sendtohttp

#1 Post by lumajo » 20 Jan 2021, 09:05

Hi folks,
I want to control my garage doors with 2 ESP01 and an RFID with another ESP01.
The setup basically works but not reliably, esp. the triggering of the event.

So there is an ESP01 which collects the RFID TAG information from the terminal. => works perfectly
Based on the RFID Tag number it sends a command to another ESP01 to open the door. (Via Rules)
SendTo,10,"event,rechts"
UPD Port is configured, both ESPs are visible to each other.
"rechts" is obviously the event which opens the right garage door at the ESP with unit number 10

So this works ..sometimes, sometimes not. sometimes it needs several attempts to work. Looking at the log file the RFID Tag was always identified correctly and the command was sent.
Is there a delay on sending via UPD? As it is mainly used for sensor data, maybe I should use the Sendtohttp instead?

As I am using domoticz, it is also possible to make a script in Domoticz, but I wanted to avoid it so far...
Any suggestions?

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

Re: use of sendto , sendtoudp or sendtohttp

#2 Post by Ath » 20 Jan 2021, 10:12

As SendTo and SendToUDP are using UDP for transport, where messages are not guaranteed to arrive at the destination, it's 'fire and forget'.
To try and solve this you could switch to using SendToHTTP (with adjusted arguments) and probably enable 'SendToHTTP wait for ack:' on Tools/Advanced page. SendToHTTP uses TCP.
/Ton (PayPal.me)

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

Re: use of sendto , sendtoudp or sendtohttp

#3 Post by TD-er » 20 Jan 2021, 12:15

What Ton means is you have to try to call the "command" URL of the other ESP.
To get the full url, try to run the event command first on the ESP via the command field on the Tools page.
This will cause a reload of the page with the full command encoded in the URL.
You can use this URL in the sendtohttp command, by stripping away the host part (starting at the first / after the host in the URL)
And don't forget to use the port (80) in the sendtohttp command.
See: https://espeasy.readthedocs.io/en/lates ... sendtohttp

lumajo
Normal user
Posts: 20
Joined: 03 Feb 2018, 13:19
Location: Munich

Re: use of sendto , sendtoudp or sendtohttp

#4 Post by lumajo » 20 Jan 2021, 18:40

Thanks for your help.
Sendtohttp works fine, but it did not on the first run, but has nothing to do with this rule.

The problem seemed to be the following:

I used the RFID Wiegand input for quite a while with a very old build. (R147) It never worked good, and the ESP01 did not work after a few days.
No I was using the newest release and I could configure more options.

No using the RFID only worked if the Tag was recognized first. not afterwards. So i had to enable the automatic Tag removal. Then it worked perfectly.
I assume now that this is the reason why the SendtoUDP or Sendto did not work either. However, as the http (with ackn) now works, no reason to change.

I found this after looking at the log file and the protocol of Domoticz...

this is the syntax that worked for me:
SendToHTTP 192.168.6.140,80,"/control?cmd=event,rechts"

I have used as much events in the rules as I have Tags. but would something like:
if [RFID#Tag] = xxxxxxx,yyyyyyyy
possible?
or do i need to make OR statements or simply, as I do it now, for each Tag # a new event?

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

Re: use of sendto , sendtoudp or sendtohttp

#5 Post by TD-er » 20 Jan 2021, 19:58

Please use the %eventvalue% in the rules instead of looking at the task values [taskname#varname] syntax.
See: https://espeasy.readthedocs.io/en/lates ... eventvalue

Post Reply

Who is online

Users browsing this forum: No registered users and 97 guests