Rule not working

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
morle
Normal user
Posts: 17
Joined: 30 Jan 2016, 08:50
Location: Germany

Rule not working

#1 Post by morle » 25 Apr 2016, 07:36

Hi,
The following setup is not working on R103:

I have 1 nodemcu(Unit 1) with the following rule:

Code: Select all

on IR#Code=4294967295 do
 sendTo 4,event,sonoff
endon
when i press the button on my remote control i can see in the log:

Code: Select all

66236634 : IR : Code ffffffff
66236635 : EVENT: IR#Code=4294967295
66236660 : ACT : sendTo 4,event,sonoff
66236703 : UDP : Send UDP message to 4
66236768 : UDP : Send UDP message to 1
66236801 : UDP : Send UDP message to 4
66237134 : HTTP : Delay 482 ms

On my sonoff(Unit 4) i have the following rules:

Code: Select all

on SW_1#switch do
  if [SW_1#switch]=0
    gpio,12,0
    gpio,13,1
  else
    gpio,12,1
    gpio,13,0
  endif
endon
on sonoff do
  if [SW_1#switch]=0
    gpio,12,0
    gpio,13,1
  else
    gpio,12,1
    gpio,13,0
  endif
endon
So when i press the button on my sonoff the LED goes on/off and the relais is working. So first rule is ok:

Code: Select all

EVENT: relais#switch=1.00
34321364 : UDP : Send UDP message to 1
34321396 : UDP : Send UDP message to 4
34321730 : HTTP : Delay 475 ms
But the second rule, which is almost the same as rule 1 just on the event sonoff, is not executed on sonoff. I can see it in the log but nothing is executed:

Code: Select all

: event,sonoff
34450707 : EVENT: sonoff
34450843 : ACT : gpio,12,1
34450849 : SW : GPIO 12 Set to 1
34450864 : ACT : gpio,13,0
34450870 : SW : GPIO 13 Set to 0


Any idea why?
Regards
Hubert

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: Rule not working

#2 Post by tozett » 25 Apr 2016, 08:12

morle wrote:

Code: Select all

on IR#Code=4294967295 do
 sendTo 4,event,sonoff
endon
when i press the button on my remote control i can see in the log:

Code: Select all

66236634 : IR : Code ffffffff
66236635 : EVENT: IR#Code=4294967295
first, your log shows, that your IR-CODE is ffffffff, but you want to send on 4294967295 ...
but the event seems to be fired on 4294967295 ....
so the ffffffff must be another reading ...

so far, so good !?
morle wrote: But the second rule, which is almost the same as rule 1 just on the event sonoff, is not executed on sonoff. I can see it in the log but nothing is executed:

Code: Select all

: event,sonoff
34450707 : EVENT: sonoff
34450843 : ACT : gpio,12,1
34450849 : SW : GPIO 12 Set to 1
34450864 : ACT : gpio,13,0
34450870 : SW : GPIO 13 Set to 0


Any idea why?
your log looks like the event sonoff _was_ executed.
the log seems to show this. or do you mean something else?

an than, your "sonoff"-rules has an if clause,

Code: Select all

on sonoff do
  if [SW_1#switch]=0
    gpio,12,0
    gpio,13,1
  else
    gpio,12,1
    gpio,13,0
  endif
endon
so there comes the sonoff-event (shown in the log),
than the if-question "if [SW_1#switch]=0".

and the execution of this is shown in the log.
or am i misreading this?

morle
Normal user
Posts: 17
Joined: 30 Jan 2016, 08:50
Location: Germany

Re: Rule not working

#3 Post by morle » 25 Apr 2016, 09:33

On the IR code difference, this is also not clear for me.
But as we can see in the log the EVENT: IR#Code=4294967295 is there when i push the button on my remote.
But for the second rule in my sonoff there is actually nothing happening even it is in the log.

The LED and the relais should go on/off as if i press manually the button.
Again the event shoes off in the log but the LED and the relais are not going on/off

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: Rule not working

#4 Post by tozett » 25 Apr 2016, 10:55

morle wrote:
But the second rule, which is almost the same as rule 1 just on the event sonoff, is not executed on sonoff. I can see it in the log but nothing is executed:

Code: Select all

: event,sonoff
34450707 : EVENT: sonoff
34450843 : ACT : gpio,12,1
34450849 : SW : GPIO 12 Set to 1
34450864 : ACT : gpio,13,0
34450870 : SW : GPIO 13 Set to 0


Any idea why?
so, the log from your first post is correct, showing execution of the event.
but you cannot see the gpio switching, means the relay does nothing.
right?

did you give it a try over an http-call?
or from the serial monitor?
maybe there is a firmware bug while executing the setting of the gpio?
wich firmware are you on? -->ahh r103, maybe downgrade to check against previous version?

morle
Normal user
Posts: 17
Joined: 30 Jan 2016, 08:50
Location: Germany

Re: Rule not working

#5 Post by morle » 25 Apr 2016, 15:36

Http call does also not work.
May be you are right, i remember it working with R101.
I flashed 2 sonoff with R103, couldn't get the third one to work wit OTA flashing with R103.
And i do not want to downgrade these, because they are working nicely except of the rule.
By the way is there any way to king of debug ESPeasy?
Regards
Hubert

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: Rule not working

#6 Post by tozett » 25 Apr 2016, 16:04

i only found the log level settings up to 9
(advanced section on the espeasy)...

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: Rule not working

#7 Post by tozett » 25 Apr 2016, 16:12

i hooked up a tsop4838 on my wemos mini d1,
it got repoducable readings from the right button of my samsung ir-remote,
but also a lot of other readings.

i discussed this before sometime somewhere in the forum,
but as long as i got _1_ correct reading from the button,
it is enough for me. i discard the rest...

there are also differenced between the web-log and the serial-log,
it think it was a type-error. i can not rember exactly, but i thing the dev was informed in the past..
Attachments
Zwischenablage07.png
Zwischenablage07.png (86.94 KiB) Viewed 10527 times

morle
Normal user
Posts: 17
Joined: 30 Jan 2016, 08:50
Location: Germany

Re: Rule not working

#8 Post by morle » 29 Apr 2016, 06:19

Hi,
I upgraded my sonoff successfully to R105, but still my rules are not working.
I have the following in my rule section:

Code: Select all

on SW_1#switch do
  if [SW_1#switch]=0
    gpio,12,0
    gpio,13,1
  else
    gpio,12,1
    gpio,13,0
  endif
endon

on Soneinaus do
  if [SW_1#switch]=0
    gpio,12,0
    gpio,13,1
  else
    gpio,12,1
    gpio,13,0
  endif
endon

on Clock#Time=all,06:00 do
    gpio,12,0
    gpio,13,1
endon

on Clock#Time=all,06:10 do
    gpio,12,1
    gpio,13,0
endon
Only the first rule is working.
Even with the command [url]http://<IP>/control?cmd=event,Soneinaus[/url] is not woking. I get an OK, but the rule is not executed even it shows up in the log:

Code: Select all

114088484 : EVENT: Soneinaus
114088598 : ACT : gpio,12,0
114088607 : SW : GPIO 12 Set to 0
114088621 : ACT : gpio,13,1
114088628 : SW : GPIO 13 Set to 1
114091870 : WD : Uptime 1897 ConnectFailures 0 FreeMem 26200
114091870 : UDP : Send Sysinfo m
Any help here?
Regards
Hubert

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: Rule not working

#9 Post by tozett » 29 Apr 2016, 10:12

morle wrote:

Code: Select all

114088484 : EVENT: Soneinaus
114088598 : ACT : gpio,12,0
114088607 : SW : GPIO 12 Set to 0
114088621 : ACT : gpio,13,1
114088628 : SW : GPIO 13 Set to 1
114091870 : WD : Uptime 1897 ConnectFailures 0 FreeMem 26200
114091870 : UDP : Send Sysinfo m
Any help here?
Regards
Hubert

the log states, that the event is triggerd via http-call,
and it says, the gpio is switched....

what is not working? your led on gpio 12/13?
maybe hardware/wiring?

morle
Normal user
Posts: 17
Joined: 30 Jan 2016, 08:50
Location: Germany

Re: Rule not working

#10 Post by morle » 29 Apr 2016, 10:51

Hi,
There is no hardware wiring. It is a sonoff.
When i push the button on the sonoff the led and the relais goes on/off as defined in the first rule.
But when i do it via the event soneinaus simply nothing happens.
Same for the other rules they are not executed.
Bug in ESPeasy?
Don't know what to do further find why it is not working.
Regards
Hubert

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: Rule not working

#11 Post by tozett » 29 Apr 2016, 11:12

but you can swith the specific GPIO 12/13 via a http-call?
and its working?
only the event does nothing on the GPIO?

morle
Normal user
Posts: 17
Joined: 30 Jan 2016, 08:50
Location: Germany

Re: Rule not working

#12 Post by morle » 29 Apr 2016, 11:28

No i can't.
The http-call is not working, the event soneinaus is not working.
However the log states both is executed, but the LED/relais do not react.
Only when i press the button on the sonoff the first rule is executed.
Hope it is clear now.
Regards
Hubert

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: Rule not working

#13 Post by tozett » 29 Apr 2016, 11:53

as i am only a user like you,
it seems that there is all tested.
a case for the dev ? ... :arrow:

MarcusDomus
New user
Posts: 1
Joined: 02 May 2016, 19:59

Re: Rule not working

#14 Post by MarcusDomus » 02 May 2016, 20:18

I was struggling with the Sonoff status too. I updated to release R105 to get rules working. R103 seems to have several problems with rule evaluation.
After that I had to study the source code to find the actions needed to get it working. I made 3 rules: switchon and switchoff to be called from Domoticz (or other controller) and a rule to handle pushing the switch.
The key is to set the pushbotton state when the relay is switched externally. The action "inputswitchstate" does this without evaluation of the gpio state.

Code: Select all

on switchon do
  gpio 12,1
  gpio 13,0
  inputswitchstate 0,1
endon

on switchoff do
  gpio 12,0
  gpio 13,1
  inputswitchstate 0,0
endon

on Switch1#Switch do
  if [Switch1#Switch]=1
    event switchon
  else
    event switchoff
  endif
endon 

morle
Normal user
Posts: 17
Joined: 30 Jan 2016, 08:50
Location: Germany

Re: Rule not working

#15 Post by morle » 03 May 2016, 23:18

Hi,
You made my day. With these rules my sonoff works also.
Thanks.
Hubert

Post Reply

Who is online

Users browsing this forum: No registered users and 55 guests