I want to turn on a WiFi socket when the tablet’s battery level is less than 6%.
I followed the instructions in the documentation (Rules - Basic | openHAB), but when I test the rule, the socket is always switched on, no matter what the charge level of the battery is.
thank you for your quick response. Sorry i dont know realy what you mean with “time of item”.
What I found in events.log:
2022-11-10 19:14:02.696 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Akku_Lenovo_Tab’ received command 92
2022-11-10 19:14:02.699 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Akku_Lenovo_Tab’ changed from 33 to 92
The item gets an update on the battery level as it should. But I think the condition “but only if” is not observed by the rule.
But I can’t find anything about the rule in any log.
Well if that is acting in “the usual GUI way”, it is normal for UI to send commands as they represent user instructions / clicks etc.
It’s not very appropriate for sensor info. (I didn’t even know the app could do this)
On the other hand, it’s not usually appropriate for a UI to be sending state updates either. Exceptional case I think.
Don’t do that unless your sensor (app) is sending a quantity with units like %
If you update a Number:Dimensionless with only numerics it will “work” without error but not give the results that you expect.
When you have a Number Item, don’t compare it to a quantity with % in your rule.
Everything that @rossko57 said with one addition. I think in versions of OH before 3.4 M3 the conditions in UI rules had a bug causing it to fail when trying to use percents. So for now just use a Number and get rid of that %.
Hello,
I have found the error. The rule works as it should, the problem is the openHAB app itself.
Logically, if you put it in battery-saving mode, it can’t send updates when the Tablet switches to power-saving mode.