Page 1 of 1

rule not triggering for distance SR04 (solved)

Posted: 09 Apr 2018, 12:24
by riker1
Hi

having a distance sensor attached

log is saying:

0843707 : EVENT: Dist_139#Dist_V=152.64
10844706 : SR04 : Distance: 151.78
10844707 : EVENT: Dist_139#Dist_V=151.78


device is defined: with value, also tried state. but as well no trigger

rule for event:
on Dist_139#Dist_V<100.00 do
GPIO,14,1
endon

is not triggering?

what am I doing wrong?

Thanks T

Re: rule not triggering for distance SR04

Posted: 23 Apr 2018, 16:32
by riker1
no hints?

Re: rule not triggering for distance SR04

Posted: 23 Apr 2018, 17:26
by wim16
Your rule test on values < 100 but the values in the log are all > 100 so it is correct the rule is not being executed.

Re: rule not triggering for distance SR04

Posted: 23 Apr 2018, 17:49
by riker1
thanks for checking,

of course I have values lower than 100

still rule not triggered.

any way to check if a rule is tiggered/passed? - debugging ?

rule and execution should show up in log, right?

like
: EVENT: Dist_139#Dist_V=6.03
4665343 : SR04 : Distance: 7.76
4665344 : EVENT: Dist_139#Dist_V=7.76
4666343 : SR04 : Distance: 7.34
4666344 : EVENT: Dist_139#Dist_V=7.34
4667342 : SR04 : Distance: 7.64
4667344 : EVENT: Dist_139#Dist_V=7.64
4668342 : SR04 : Distance: 7.66
4668344 : EVENT: Dist_139#Dist_V=7.66
4669342 : SR04 : Distance: 7.64
4669344 : EVENT: Dist_139#Dist_V=7.64
4670342 : SR04 : Distance: 7.50
4670344 : EVENT: Dist_139#Dist_V=7.50
4671342 : SR04 : Distance: 8.24
4671344 : EVENT: Dist_139#Dist_V=8.24

Re: rule not triggering for distance SR04

Posted: 23 Apr 2018, 18:16
by wim16
What if you leave out the condition in the on statement?
And what firmware do you use?
Rules are not easily tested indeed, you might change the loglevel to see if it shows more info.

Re: rule not triggering for distance SR04

Posted: 23 Apr 2018, 18:34
by riker1
wim16 wrote: 23 Apr 2018, 18:16 What if you leave out the condition in the on statement?
And what firmware do you use?
Rules are not easily tested indeed, you might change the loglevel to see if it shows more info.

Hi

do you mean :

on Dist_139#Dist_V do
GPIO,16,0
endon




led 16 not triggered.
log does not say anything about GPIO command


did set loglevel to debug, but does not show me a hint.


using: mega-20180409

Re: rule not triggering for distance SR04

Posted: 23 Apr 2018, 18:44
by riker1
did switch on debug serial and see more

but only

RuleDebug: 100: dist_139#dist_v<100.00 do
RuleDebug: 101: gpio,16,0

but does not show execution of gpio command.


EVENT: Dist_139#Dist_V=125.34 Processing time:47 milliSeconds
HTTP : connecting to 192.168.0.9:8383
HTTP : closing connection
SR04 : Distance: 13.12
EVENT: Dist_139#Dist_V=13.12
RuleDebug Processing:rules1.txt
flags CMI parse output:
RuleDebug: 100: dist_139#dist_v<100.00 do
RuleDebug: 101: gpio,16,0
RuleDebug Processing:rules2.txt
flags CMI parse output:
RuleDebug Processing:rules3.txt
flags CMI parse output:
RuleDebug Processing:rules4.txt
flags CMI parse output:
EVENT: Dist_139#Dist_V=13.12 Processing time:49 milliSeconds
HTTP : connecting to 192.168.0.9:8383
HTTP/1.1 200 OK

HTTP : Success
Content-Type: text/plain

Connection: close

Content-Length: 0



HTTP : closing connection
SR04 : Distance: 7.16
EVENT: Dist_139#Dist_V=7.16
RuleDebug Processing:rules1.txt
flags CMI parse output:
RuleDebug: 100: dist_139#dist_v<100.00 do
RuleDebug: 101: gpio,16,0
RuleDebug Processing:rules2.txt
flags CMI parse output:
RuleDebug Processing:rules3.txt
flags CMI parse output:
RuleDebug Processing:rules4.txt
flags CMI parse output:
EVENT: Dist_139#Dist_V=7.16 Processing time:47 milliSeconds
HTTP : connecting to 192.168.0.9:8383
HTTP/1.1 200 OK

HTTP : Success
Content-Type: text/plain

Connection: close

Content-Length: 0

Re: rule not triggering for distance SR04

Posted: 23 Apr 2018, 18:49
by riker1
Hi

also tried now using state with threshold.
values are correct, but rule still not executed....

is it maybe a problem upper lower letters?



HTTP : closing connection
SR04 : State 1
EVENT: Dist_139#Dist_V=1.00
RuleDebug Processing:rules1.txt
flags CMI parse output:
RuleDebug: 100: dist_139#dist_v=1.00 do
RuleDebug: 101: gpio,16,0
RuleDebug Processing:rules2.txt
flags CMI parse output:
RuleDebug Processing:rules3.txt
flags CMI parse output:
RuleDebug Processing:rules4.txt
flags CMI parse output:
EVENT: Dist_139#Dist_V=1.00 Processing time:47 milliSeconds
HTTP : connecting to 192.168.0.9:8383
HTTP/1.1 200 OK

HTTP : Success
Content-Type: text/plain

Connection: close

Content-Length: 0



HTTP : closing connection
SR04 : State 0
EVENT: Dist_139#Dist_V=0.00
RuleDebug Processing:rules1.txt
flags CMI parse output:
RuleDebug: 100: dist_139#dist_v=1.00 do
RuleDebug: 101: gpio,16,0
RuleDebug Processing:rules2.txt
flags CMI parse output:
RuleDebug Processing:rules3.txt
flags CMI parse output:
RuleDebug Processing:rules4.txt
flags CMI parse output:
EVENT: Dist_139#Dist_V=0.00 Processing time:47 milliSeconds
HTTP : connecting to 192.168.0.9:8383
HTTP/1.1 200 OK

HTTP : Success
Content-Type: text/plain

Connection: close

Content-Length: 0



HTTP : closing connection
SR04 : State 1
EVENT: Dist_139#Dist_V=1.00
RuleDebug Processing:rules1.txt
flags CMI parse output:
RuleDebug: 100: dist_139#dist_v=1.00 do

Re: rule not triggering for distance SR04

Posted: 23 Apr 2018, 18:52
by riker1
solved it.

looks like it was caused by some blanks in the ruleset.!!!!!

Thanks for helping

Re: rule not triggering for distance SR04 (solved)

Posted: 23 Apr 2018, 19:27
by wim16
Good!