Strange behaviour: rules mess up devices
Moderators: grovkillen, Stuntteam, TD-er
Strange behaviour: rules mess up devices
I have a strange problem with rules on my WiFi candle.
There are 2 devices connected to an ESP8266-01: The LEDs for the candle and a PIR to switch them on or off.
Both devices work okay. My setup is as follows:
and both devices work as expected:
However, as soon as I enable my simple rules:
to switch the LEDs on and of with the PIR, the Candle device gets screwed up. The name changes to PIR and the first value changes from "Color" to "Switch":
and the EVENTS in the log also go crazy:
It works for a short time (Candle switches when PIR is activated) but after half a minute or so it doesn't work anymore.
Any idea what happens here? Are my rules wrong?
There are 2 devices connected to an ESP8266-01: The LEDs for the candle and a PIR to switch them on or off.
Both devices work okay. My setup is as follows:
and both devices work as expected:
However, as soon as I enable my simple rules:
to switch the LEDs on and of with the PIR, the Candle device gets screwed up. The name changes to PIR and the first value changes from "Color" to "Switch":
and the EVENTS in the log also go crazy:
It works for a short time (Candle switches when PIR is activated) but after half a minute or so it doesn't work anymore.
Any idea what happens here? Are my rules wrong?
Re: Strange behaviour: rules mess up devices
CANDLE in capital Letters might be the problem. It Shows in small Letters in events. Also, where do the "::" Come from? . I found strange behaviour when not respecting syntax of Rules. ( like end on instead of endon, or. Instead of,)
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Strange behaviour: rules mess up devices
Thanks for your answer.
I tried all kinds of upper/lower letters with no effect.
The : separates the arguments, see the authors examples in sourcecode:
I tried all kinds of upper/lower letters with no effect.
The : separates the arguments, see the authors examples in sourcecode:
Code: Select all
// Commands
// CANDLE:<FlameType>:<Color>:<Brightness>
// <FlameType> : 1 Static Light, 2 Simple Candle, 3 Advanced Candle, 4 Police, 5 Blink, 6 Strobe, 7 Color Fader
// <Color> : n.def. Use the default color
// RRGGBB Use color in RRGGBB style (red, green blue) as HEX
// <Brightness> : 0-255
// Samples: CANDLE:2::100 Simple Candle with Default color and Brigthness at 100
// CANDLE:5:FF0000:200 Blink with RED Color and Brigthness at 200
// CANDLE:0:: Candle OFF
// CANDLE:1::255 Candle ON - White and full brigthness
Re: Strange behaviour: rules mess up devices
I still think it gots to do with rule syntax. Maybe you can try the following:groovy wrote:Thanks for your answer.
I tried all kinds of upper/lower letters with no effect.
The : separates the arguments, see the authors examples in sourcecode:
Code: Select all
// Commands // CANDLE:<FlameType>:<Color>:<Brightness> // <FlameType> : 1 Static Light, 2 Simple Candle, 3 Advanced Candle, 4 Police, 5 Blink, 6 Strobe, 7 Color Fader // <Color> : n.def. Use the default color // RRGGBB Use color in RRGGBB style (red, green blue) as HEX // <Brightness> : 0-255 // Samples: CANDLE:2::100 Simple Candle with Default color and Brigthness at 100 // CANDLE:5:FF0000:200 Blink with RED Color and Brigthness at 200 // CANDLE:0:: Candle OFF // CANDLE:1::255 Candle ON - White and full brigthness
CANDLE:0::0 for switching off.
Also, for debugging purposes, try and flash an LED when you execute code. Maybe it helps with finding the fault. I'll think about it again.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Strange behaviour: rules mess up devices
toffel969 wrote:I still think it gots to do with rule syntax. Maybe you can try the following:groovy wrote:Thanks for your answer.
I tried all kinds of upper/lower letters with no effect.
The : separates the arguments, see the authors examples in sourcecode:
Code: Select all
// Commands // CANDLE:<FlameType>:<Color>:<Brightness> // <FlameType> : 1 Static Light, 2 Simple Candle, 3 Advanced Candle, 4 Police, 5 Blink, 6 Strobe, 7 Color Fader // <Color> : n.def. Use the default color // RRGGBB Use color in RRGGBB style (red, green blue) as HEX // <Brightness> : 0-255 // Samples: CANDLE:2::100 Simple Candle with Default color and Brigthness at 100 // CANDLE:5:FF0000:200 Blink with RED Color and Brigthness at 200 // CANDLE:0:: Candle OFF // CANDLE:1::255 Candle ON - White and full brigthness
CANDLE:0::0 for switching off.
Also, for debugging purposes, try and flash an LED when you execute code. Maybe it helps with finding the fault. I'll think about it again.
Not really a solution, but maybe a workaround. try using the http command /udp to switch it off
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Strange behaviour: rules mess up devices
I already tried the HTTP method, see my post here, where also the actual ruleset comes from.
What I really don't understand is, that it works for the first time, but as soon as the PIR is switched for the first time, it messes up the device.
I will test it further, thanks for your suggestions.
What I really don't understand is, that it works for the first time, but as soon as the PIR is switched for the first time, it messes up the device.
I will test it further, thanks for your suggestions.
Re: Strange behaviour: rules mess up devices
what is the reset time of your pir? anyway, maybe try a timer. instead of using pir=0 to switch off, try using a timerSet command to set desired time and then the 'candle off command' in the timer rule.groovy wrote:I already tried the HTTP method, see my post here, where also the actual ruleset comes from.
What I really don't understand is, that it works for the first time, but as soon as the PIR is switched for the first time, it messes up the device.
I will test it further, thanks for your suggestions.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Strange behaviour: rules mess up devices
as far as i can see the log, its only after pir=0groovy wrote:I already tried the HTTP method, see my post here, where also the actual ruleset comes from.
What I really don't understand is, that it works for the first time, but as soon as the PIR is switched for the first time, it messes up the device.
I will test it further, thanks for your suggestions.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Strange behaviour: rules mess up devices
The first log is without the rules being active. Will try your suggestions when I get back to the device tomorrow, thanks.toffel969 wrote:as far as i can see the log, its only after pir=0
Re: Strange behaviour: rules mess up devices
Just did some tests again. The device get's messed up as soon as the PIR switches for the first time, no matter if it's on or off.toffel969 wrote:as far as i can see the log, its only after pir=0
I also tried a timer instead of the PIR for switching off:
Code: Select all
on PIR#Switch do
CANDLE:3::60
timerSet 1,10
endon
on Rules#Timer=1 do
CANDLE:0::
endon
Is it possible that the ":" separator is somehow misinterpreted by another part of the code and replacing it with something may help?
Re: Strange behaviour: rules mess up devices
Maybe try to swap the devices (make PIR Task1 and Candle Task2). Sonst fällt mir auch nichts mehr eingroovy wrote:Just did some tests again. The device get's messed up as soon as the PIR switches for the first time, no matter if it's on or off.toffel969 wrote:as far as i can see the log, its only after pir=0
I also tried a timer instead of the PIR for switching off:
Same result. Candle device is renamed to "PIR" and first value name is set to "Switch" as soon as the PIR switches on.Code: Select all
on PIR#Switch do CANDLE:3::60 timerSet 1,10 endon on Rules#Timer=1 do CANDLE:0:: endon
Is it possible that the ":" separator is somehow misinterpreted by another part of the code and replacing it with something may help?
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Strange behaviour: rules mess up devices
Will try this tomorrow. Danke dir.
Re: Strange behaviour: rules mess up devices
This is very strange. I just swapped the devices and now the candle device stays intact but the PIR is renamed to "CANDLE" and the value is renamed from "Switch" to "Color".toffel969 wrote:Maybe try to swap the devices (make PIR Task1 and Candle Task2).
So it seems it's affecting always the first device
Update:
With my last sentence in mind, I created a dummy device as the first one, candle as second and PIR as third.
Now, as expected, the dummy device is renamed to PIR and the value name to Switch, but my candle doesn't get touched and works now.
This is a workaround, but obviously not the solution.
Last edited by groovy on 14 Feb 2017, 07:57, edited 1 time in total.
Re: Strange behaviour: rules mess up devices
2 thoughts. change build version , avoid using the first task, just use 2+3 . but this is really strangegroovy wrote:This is very strange. I just swapped the devices and now the candle device stays intact but the PIR is renamed to "CANDLE" and the value is renamed from "Switch" to "Color".toffel969 wrote:Maybe try to swap the devices (make PIR Task1 and Candle Task2).
So it seems it's affecting always the first device
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Strange behaviour: rules mess up devices
You are fast
See my update on the former post.
See my update on the former post.
Re: Strange behaviour: rules mess up devices
Great minds think alike, and fools never differ glad to hear you got it workinggroovy wrote:You are fast
See my update on the former post.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Who is online
Users browsing this forum: No registered users and 1 guest