cannot get %eventvalue% to work

Moderators: BertB, rtenklooster, Voyager, Stuntteam, Martinus

Message
Author
bartv
Normal user
Posts: 6
Joined: 13 Jan 2018, 20:07

cannot get %eventvalue% to work

#1 Post by bartv » 13 Jan 2018, 20:18

Hello forum,

using a sonoff module,
I put in rules as shown below.
when running " http://sonoff-12/control?cmd=event,TimerOn" in my browser
the LED is lit for 10 seconds, everything ok.
but when putting " http://sonoff-12/control?cmd=event,remoteTimerControl=5" in my browser
the LED blink shortly, sometimes very short, sometimes half a second.
It looks to me that the eventvalue is not forwarded ?
Pls help !

Regards, Bart

Code: Select all

// LED off/on
on LedOff do
  gpio,13,1
endon
on LedOn do
  gpio,13,0
endon

on remoteTimerControl do
   event LedOn
   timerSet,1,%eventvalue%
 endon

on rules#timer=1 do
  event LedOff
endon

on TimerOn do
  event LedOn
  timerset,2,10
endon

on rules#timer=2 do
  event LedOff
endon

User avatar
grovkillen
Normal user
Posts: 1614
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: cannot get %eventvalue% to work

#2 Post by grovkillen » 13 Jan 2018, 21:00

Try this :

Code: Select all

on remoteTimerControl do
  timerSet,1,%eventvalue%
   event LedOn
 endon
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
:idea: Sponsor ESP Easy :idea:

bartv
Normal user
Posts: 6
Joined: 13 Jan 2018, 20:07

Re: cannot get %eventvalue% to work

#3 Post by bartv » 14 Jan 2018, 01:03

hello grovkillen, thanks for your reply,

but, nope, doesn't change a thing.
still irregular times between +/- 0.2 and 1 second.
reboot and power-off/on also doesn't help after changing rules (just to be sure)
behavior stays the same.

Bart

bartv
Normal user
Posts: 6
Joined: 13 Jan 2018, 20:07

Re: cannot get %eventvalue% to work

#4 Post by bartv » 14 Jan 2018, 01:05

oh, and tried to have the rule with %eventvalue% as first line in Rules,
so eventvalue is on second line, but that didn't help either.

Bart

User avatar
vader
Normal user
Posts: 238
Joined: 21 Mar 2017, 17:35

Re: cannot get %eventvalue% to work

#5 Post by vader » 14 Jan 2018, 21:41

Take this version without any stupid rules....

"http://sonoff-12/control?cmd=longpulse+13%2C0%2C10" (example for 10 seconds)

Change the "10" to your needed value of seconds to turn LED on and that was it....

bartv
Normal user
Posts: 6
Joined: 13 Jan 2018, 20:07

Re: cannot get %eventvalue% to work

#6 Post by bartv » 15 Jan 2018, 20:47

Hello Vader,

yep that works!!

Still it is strange why eventvalue does not work
I cannot find the error in what i'm doing, but also nobody with the same problem using google.
It's very unlikely i'm the only one ;-)

But, for now, i can use your solution to what i'm creating, so thank you !!

Bart

User avatar
vader
Normal user
Posts: 238
Joined: 21 Mar 2017, 17:35

Re: cannot get %eventvalue% to work

#7 Post by vader » 15 Jan 2018, 22:00

No problem, man. I have all that already behind me. And sometimes it's better not to be an engineer for simple solutions.... :D

This works also:
http://sonoff-12/control?cmd=event,remoteTimerControl=5

on remoteTimerControl do
longpulse,13,0,%eventvalue%
endon

bartv
Normal user
Posts: 6
Joined: 13 Jan 2018, 20:07

Re: cannot get %eventvalue% to work

#8 Post by bartv » 16 Jan 2018, 06:20

Hello Vader,

I'm sorry, but the rule you propose

on remoteTimerControl do
longpulse,13,0,%eventvalue%
event LedOn
endon

has exactly the same result as my initial rule, it works, but the length of the timer is not correctly set.
The led now is lit for a short while, few tenths of a second, up to half a second.
so eventvalue is not passed through in this case either.

Bart

User avatar
grovkillen
Normal user
Posts: 1614
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: cannot get %eventvalue% to work

#9 Post by grovkillen » 16 Jan 2018, 06:35

bartv wrote:
16 Jan 2018, 06:20
Hello Vader,

I'm sorry, but the rule you propose

on remoteTimerControl do
longpulse,13,0,%eventvalue%
event LedOn
endon

has exactly the same result as my initial rule, it works, but the length of the timer is not correctly set.
The led now is lit for a short while, few tenths of a second, up to half a second.
so eventvalue is not passed through in this case either.

Bart
He didn't propose this part :

on remoteTimerControl do
longpulse,13,0,%eventvalue%
event LedOn
endon

I think you misunderstand the long pulse command, it will (given the example above, using state 0) turn the led off and when the given time is up turn it back on. No need for the event you added.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
:idea: Sponsor ESP Easy :idea:

User avatar
vader
Normal user
Posts: 238
Joined: 21 Mar 2017, 17:35

Re: cannot get %eventvalue% to work

#10 Post by vader » 16 Jan 2018, 09:24

bartv wrote:
16 Jan 2018, 06:20
Hello Vader,

I'm sorry, but the rule you propose

on remoteTimerControl do
longpulse,13,0,%eventvalue%
event LedOn
endon

has exactly the same result as my initial rule, it works, but the length of the timer is not correctly set.
The led now is lit for a short while, few tenths of a second, up to half a second.
so eventvalue is not passed through in this case either.

Bart
My rule is only 3 lines long, yours has 4! "event LedOn" is nonsense, because you are already turning on the LED with "13,0" (inversed logic). I have tested the rule on my test board and it works like it should be. So %eventvalue% works....

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests