Rules WebSend problem

466 views
Skip to first unread message

LBuch

unread,
May 11, 2021, 2:34:34 PM5/11/21
to TasmotaUsers
In Tasmota I am using rules and I want to set a value in a variable either Var1 or Mem1 to different values based on the states of Power1 Power2 etc. Then I need to do a WebSend to send out that value of Var1. So the WebSend starts with the ip and the API command set, then the Var1, then the access token etc. There must be no spaces before or after the value of Var1. The problem is how do I get it to substitute the value rather than the name Var1. I tried %Var1%  that does not work. Neither does quotes. I have not found any documentation with examples. 

sfromis

unread,
May 11, 2021, 2:44:41 PM5/11/21
to TasmotaUsers
%Var1% works, but only within a rule, not as a console command.

Philip Knowles

unread,
May 11, 2021, 3:03:09 PM5/11/21
to LBuch, TasmotaUsers

There is an example of how to use the value of an output here

 

Rules - Tasmota

 

 

Sent from Mail for Windows 10

--
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/880f28a1-3f1a-46c4-8dc0-c53fe04d0581n%40googlegroups.com.

 

LBuch

unread,
May 12, 2021, 9:10:34 AM5/12/21
to TasmotaUsers
Thanks.  
I was making the mistake of testing it the console rather than in an actual rule.  
Now I find a another problem with my rule not working.
on Power1#state do triggers the rule everytime the value of power1 changes.
But how can I trigger the rule when the value of var1 changes?  Thanks.  
I tested var1#state do does not trigger the rule. 

lexxai

unread,
May 12, 2021, 10:13:24 AM5/12/21
to sonof...@googlegroups.com

Var<x>#State     when the value for Var<x> is changed (triggers whenever a value is written to Var<x> even if its the same value)

I use:

ON var1#state>1.000 DO var2 0 ENDON
ON var2#state=0 DO power0 0 BREAK
ON var4#state==10 DO mult5 2 BREAK


12.05.21 16:10, LBuch :
--
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.

LBuch

unread,
May 12, 2021, 12:46:21 PM5/12/21
to TasmotaUsers
How can I make ir work with string variable type?

Here is cut and paste from my console.  It does not work:

12:40:42 CMD: rule3
12:40:42 RSL: RESULT = {"Rule3":"ON","Once":"OFF","StopOnError":"OFF","Length":33,"Free":478,"Rules":"on Var1#state=HI  do var2 2 endon"}
12:40:58 CMD: var2 0
12:40:58 RSL: RESULT = {"Var2":"0"}
12:41:07 CMD: var1 XX
12:41:07 RSL: RESULT = {"Var1":"XX"}
12:42:29 CMD: var1 HI
12:42:29 RSL: RESULT = {"Var1":"HI"}
12:43:29 CMD: var2
12:43:29 RSL: RESULT = {"Var2":"0"}

sfromis

unread,
May 12, 2021, 1:17:41 PM5/12/21
to TasmotaUsers
19:15:48.565 CMD: rule1
19:15:48.573 MQT: stat/xxxxxxx/RESULT = {"Rule1":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":37,"Free":474,"Rules":"on Var1#state=HI do var2 Got HI endon"}}
19:16:01.285 CMD: var1 hi
19:16:01.293 MQT: stat/xxxxxxx/RESULT = {"Var1":"hi"}
19:16:01.329 RUL: VAR1#STATE=HI performs "var2 Got HI"
19:16:01.337 MQT: stat/xxxxxxx/RESULT = {"Var2":"Got HI"}


LBuch

unread,
May 12, 2021, 10:06:20 PM5/12/21
to TasmotaUsers
I can not get same results as you are showing me.  Mine works except when the variable is a string.
Are you running the stock version or one compiled with the extra rules features activated?
reflashed and retested still does not work.  This is very frustrating.

sfromis

unread,
May 13, 2021, 6:02:31 AM5/13/21
to TasmotaUsers
I'd suggest not "wasting" your time on by now rather old versions, but use current Tasmota, like I used to test.

Larry Buchanan

unread,
May 14, 2021, 6:57:16 PM5/14/21
to sfromis, TasmotaUsers
Thanks. I upgraded to ver 9.4.0.3 and the rule worked OK. This was the first time I used version 9.  
WOW.  The templates are very different.  
Does anybody have any experience with the Sonoff POW R2 if it will handle a 1/2hp pump?  The specs show 5.3 Amps but I am sure the startup current is going to be considerably more for a very short duration. 

On Thu, May 13, 2021 at 6:02 AM sfromis <sfr...@gmail.com> wrote:
I'd suggest not "wasting" your time on by now rather old versions, but use current Tasmota, like I used to test.

--
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.


--

Philip Knowles

unread,
May 15, 2021, 1:09:14 AM5/15/21
to sfromis, buchana...@gmail.com, TasmotaUsers
The motor will draw 30-40 A instantaneously at start up and reduce to around 10-15A for a few seconds until it reaches operating speed. Some relays will cope with that but it's why 'contactors' tend to be used for motors and high inrush devices. But you also need to think of the 'break arc' too which is more destructive to the relay
To be on the safe side I would probably use a contactor or heavy duty relay in parallel to start the motor, switch the POW in after 5 seconds and let the contactor drop out 5 seconds later. At switch off bring the contactor in for a second or two before switching the POW off and then use the contactor to stop the motor. Many contactors have an auxiliary contact which could be used as a signal to the POW in a rule.
You may not need any of this but the relay rating on most devices is the resistive load.
Regards

Phil K


From: sonof...@googlegroups.com <sonof...@googlegroups.com> on behalf of Larry Buchanan <buchana...@gmail.com>
Sent: Friday, May 14, 2021 11:56:37 PM
To: sfromis <sfr...@gmail.com>
Cc: TasmotaUsers <sonof...@googlegroups.com>
Subject: Re: Rules WebSend problem
 
Reply all
Reply to author
Forward
0 new messages