KNX brightness, use in rule

Hello,

I have a
KNX weather station which reads temp, wind an brightness. I would like to use
those values in rules in OR. The reason for that is that i want it to combine
it with some other conditions which are not KNX, otherwise, straight KNX setup
would have been an easier solution.

Now my
first simple rule is to put on a light when sunset. I have a custom sensor
which reads the brightness and can read the values of it on the app, so the
sensor should be ok.

the rule I have:

rule “alarm aanwezig inactief licht”
when
// $evt:Event(source == “virtual_sensor_aanw”, value == “0”)
$evt2:Event(source == “read brightness”, value < “800.0”)
then
execute.command(“licht leeslamp living (ON)”);
end

``

There
seems to be some problem with this rule. The light goes on immediately after
syncing the controller, but that is a init problem.

But,
about a minute I switched it back off, it will go on again (so it
does not fire immediately), no matter what the value of the
brightness at that moment is (during daytime it goes easily above 20000). Even
when I reverse the sign to “>”, the same thing happens.

You see
that I commented the other condition to be sure the second condition is the
problem.

I have been wondering, if
this might have to do something with the fact that this value might be hex? I
mean When I perform a read in ETS, it states:

6 13:54:14.817 from
bus L 1.1.10 2/0/3 helderheid 6 2
byte Response 4C 58 | 5693,44

When
reading the value of the sensor in the app, it displays with a dot instead of a
comma. tried also “800,0”, problem remains.

And an
additional question, This value is read cyclically. So it is possible it will
have value 805 and next time 795 and followed by 790. This change will fire
the rule one time, right? So “event”

And for
the other sensor, I want that one to be actually a state. I mean as long as it
is zero, the brightness might trigger the lamp. Is it a good idea to use
“Event” for that?

Many thanks!

Purely a guess....

Have you tried this :-

rule "alarm aanwezig inactief licht"
when
Event(source == "read brightness", value < "800.0")
then
  execute.command("licht leeslamp living (ON)");
end

Actually that was my starting point. But with trial and error from some sample rules I added the “$evt”.

Thx anyway

Please look into rules log file located in logs/rules/drools.log file. You should see when the rule is triggered and with which values. The first remark is that you are trying to compare a numeric value with a string. I thing that you should define “read brightness” as level or range sensor and the rule should be:

rule “alarm aanwezig inactief licht”
when

``
Event(source == "read brightness", value < 800.0) then execute.command("licht leeslamp living (ON)"); end

Thx again! The string definition with " was indeed causing the problem here.