RE: websend from device with script to device with rules

594 views
Skip to first unread message

Philip Knowles

unread,
Jul 30, 2021, 9:02:41 AM7/30/21
to Automater, TasmotaUsers

Try it with var1 rather than myval. You may be able to call variables what you like in scripts but var1-16 are valid commands while myval isn’t

 

 

 

Sent from Mail for Windows 10

 

From: Automater
Sent: 30 July 2021 13:37
To: TasmotaUsers
Subject: websend from device with script to device with rules

 

I have 2 tasmota devices communication via websend. Sending something from the script device to the rules device works well. But sending

websend [192.168.1.5] myval 123 

from the rule device to the script device having

>D

myval=0

>E

print from_rule_device %myval%

stays at "from_rule_device 0.00"

What's wrong? The IP address is correct and can be pinged.

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/1f233e09-5132-4e2e-bcbe-2eefc5ae2c15n%40googlegroups.com.

 

Automater

unread,
Jul 30, 2021, 9:42:03 AM7/30/21
to TasmotaUsers
With var1 it didn't work either. I wonder if I can check if the receiver got something. The sender logged 

RESULT {"WebSend":"Done"}

so I guess it went out well.

Automater

unread,
Jul 30, 2021, 9:48:56 AM7/30/21
to TasmotaUsers
update: websending from scripting device to the rules device works flawlessly

WebSend [192.168.1.5] Var8 123

swapping the IP addresses should work then if Var8 is defined in the script define section, right?

Philip Knowles

unread,
Jul 30, 2021, 12:29:35 PM7/30/21
to Automater, TasmotaUsers

If you, in my case, websend [192.168.2.120] var1 2

You should see, in Console,

17:08:53.164 MQT: stat/Sonoff-Pump/RESULT = {"Var1":"2"}

So you know that var1 has been updated

If that does appear the issue is with scripting – perhaps you need to set the variable in the script with myval = %var1%?

 

Perhaps this is may be an easier solution

g:vname
specifies global variable which is linked to all global variables with the same defintion on all devices in the homenet. when a variable is updated in one device it is instantly updated in all other devices. if a section >G exists it is executed when a variable is updated from another device (this is done via UDP-multicast, so not always reliable)

 

or permanent variables

Automater

unread,
Jul 30, 2021, 3:19:13 PM7/30/21
to TasmotaUsers
In my case I do

on Event#PublishTemp do

backlog WebSend [%var2%] Var1 %Var1%; WebSend [192.168.2.5] VAR8 %Var2%

endon

where the frist websend (to a 3rd device running rules) goes fine, the second (to a scripting device) fails.
There is nothing in the console except
21:18:23.515 MQT: stat/SP12/RESULT = {"WebSend":"Done"}
21:18:23.825 MQT: stat/SP12/RESULT = {"WebSend":"Done"}

Philip Knowles

unread,
Jul 30, 2021, 3:27:53 PM7/30/21
to Automater, TasmotaUsers

No you need to look in the Console of the receiving device

Automater

unread,
Aug 1, 2021, 3:56:38 AM8/1/21
to TasmotaUsers
I got it.
The websend payload must be a valid script command line. In general
websend <valid command on scripting device>
is the correct syntax. E. g.
websend script >myvar=%Var1%

Philip Knowles

unread,
Aug 1, 2021, 6:26:23 AM8/1/21
to Automater, TasmotaUsers
Reply all
Reply to author
Forward
0 new messages