Hi, I use OH 3.4 and have a thing called “sunsensor”. It’s a somfy device which is embedded through the tahoma binding and gives me an illumination value in lux.
I did create a new rule which take some action if the lux value of the sun sensor is less than 100.
So I use Add Trigger item event and choose first the sunsensor… then I did choose "was updated"and as state I sayed “<100” that this rule triggers when the lux values goes under 100.
The problem is now, that when the value of the sensor goes under 100 lux nothing happens.
How I have to create this rule that it works fine ?
Many thanks for your help
I have other rules configured w/o a condition and they work perfect. I understand it the way, that a condition is only needed when the trigger should start only e.g. at weekend when defined value has been reached. w/o the condition this runs allways when the desired value has been reached.
in the tahoma binding i found this: thing: light sensor, channel: luminance, Note:light luminance value in luxes. So I did try to set “<100lx”, “<100 lx”, “<100lxs”, <100 lxs" but nothing worked. I did even tried to set just “100lx”, “100” without < but the trigger never fires.
What is the right value?
Can someone make me an exaple with the possible right code?
A rule without a condition can NOT evaluated a desired value, because that would be a condition!
Do not mix up the trigger of a rule (a state change or update of an item or the like) and the condition.
For example a rule triggers on the change of an temperature item. If there is a condtion set it will be checked by the rule, if the condition is met the script part ( then…) will be run otherwise the rule is finished without the script.
The same rule without a condition would run the script part on each and every change of the connected item.
I’m sure they do. They also don’t have something like “<100” anywhere in the trigger because that is, to be blunt, nonsense. You can’t do comparisons like that in the trigger. You must use a condition.
Not exactly, using a (second) condition the rule would be triggered by every change, however the script part would be run only when all conditions are met.
Looking at the UI for creating your desired second condition it seems to be possible only via a script.
If it would be me, I would simply disable to whole rule by hand outside the desired timeframe.
@opus hit on one of the more clever ways to do it. You can automate it and create a rule that enables the rule on June 1st and then a second one on September 30th to disable it. Then the rule will sit disabled and inert the rest of the year.
I do something similar for my Christmas lights rules. I reuse some smart plugs that normally control my humidifiers to run some lights,. So I have a Switch that I set to ON when I’ve set up the lights which disables the humidifier rules and enables the christmas lights rules. When I flip it back it swaps back.
You could use a Switch in the condition of the rule too instead of disabling, but I like how the status of the rule appears in MainUI making it clear that the rule will not run.