Page 1 of 1

cannot get %eventvalue% to work

Posted: 13 Jan 2018, 20:18
by bartv
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

Re: cannot get %eventvalue% to work

Posted: 13 Jan 2018, 21:00
by grovkillen
Try this :

Code: Select all

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

Re: cannot get %eventvalue% to work

Posted: 14 Jan 2018, 01:03
by bartv
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

Re: cannot get %eventvalue% to work

Posted: 14 Jan 2018, 01:05
by bartv
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

Re: cannot get %eventvalue% to work

Posted: 14 Jan 2018, 21:41
by vader
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....

Re: cannot get %eventvalue% to work

Posted: 15 Jan 2018, 20:47
by bartv
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

Re: cannot get %eventvalue% to work

Posted: 15 Jan 2018, 22:00
by vader
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

Re: cannot get %eventvalue% to work

Posted: 16 Jan 2018, 06:20
by bartv
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

Re: cannot get %eventvalue% to work

Posted: 16 Jan 2018, 06:35
by grovkillen
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.

Re: cannot get %eventvalue% to work

Posted: 16 Jan 2018, 09:24
by vader
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....

Re: cannot get %eventvalue% to work

Posted: 16 Jan 2018, 22:49
by bartv
helle grovkillen & vader,

you're correct , my mistake, i apologize.

I used cut&paste, and now these 3 lines are the only lines in Rules.

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

saved/reboot/check if really ok, 60 characters.

did use : http://sonoff-12/control?cmd=event,remoteTimerControl=5
same behaviour. It wil not create a stable pulse for 5 seconds, just a short blink

using http://sonoff-12/control?cmd=longpulse+13%2C0%2C5
response is : (JSON filter in Firefox)
log "GPIO 13 Pulse set for 5 S"
plugin 1
pin 13
mode "output"
state 0

and the LED is lit for 5 seconds

tested firefox and internet explorer on windows10
espeasy
Build: 120
Core Version: 2_3_0
for some reason eventvalue will not work.

Bart

Re: cannot get %eventvalue% to work

Posted: 17 Jan 2018, 08:59
by vader
Ok Windows 10 is a virus of its own.... :mrgreen: But, why are you using that old version of ESPeasy (R120)? You should try R147 or better 2.xx.

Re: cannot get %eventvalue% to work

Posted: 17 Jan 2018, 09:06
by grovkillen
vader wrote: 17 Jan 2018, 08:59 Ok Windows 10 is a virus of its own.... :mrgreen: But, why are you using that old version of ESPeasy (R120)? You should try R147 or better 2.xx.
I have a hate/love relation with Windows. I used to be full fledged Ubuntu until Windows 10, I have always used Windows at work and script stuff so when Windows 10 turned out pretty decent and I got a new computer, and Microsoft gave all cracked Windows 8.1 users free upgrade to Windows 10 I jumped ship.

But on topic: yes we are on the verge of releasing the next version and have stopped active support of R120 (even though it's still the official release). Give us a few more months and 2.0.0 will be replacing R120 as the official version. In the meantime please help us find bugs. New features are also welcomed but will most likely have to wait until 2.1.0 (or if you are daring, use the nightly builds of "mega").

Re: cannot get %eventvalue% to work

Posted: 17 Jan 2018, 09:15
by vader
@grovkillen: Micro$oft lives from user are not seeing what crap they use... :lol:

Re: cannot get %eventvalue% to work

Posted: 17 Jan 2018, 09:20
by grovkillen
vader wrote: 17 Jan 2018, 09:15 @grovkillen: Micro$oft lives from user are not seeing what crap they use... :lol:
I agree, and swallow the bait at the same time :roll:

Re: cannot get %eventvalue% to work

Posted: 23 Oct 2018, 19:01
by uxhamby
Hey Vader,
What kinda talk is that and where can I learn to talk it too?

Brian H