Simple IF rule with Humidity Change

Hey there,

i live in a old house, which has a bit problems with humidity…

My Plan was to actiavte a dehumidifier with a smart plug when my humidity sensor says humidity over 70%.
For that i am using a simple xiaomi temp sensor.

my rule is looking like this:

rule “Luftentfeuchter”
when
Item BadLuftfeuchtigkeit changed
then
if (BadLuftfeuchtigkeit.state > 70){
SteckdoseBadUnten.sendCommand(ON)
}
end

Item:

Number:Dimensionless BadLuftfeuchtigkeit “Luftfeuchte Badezimmer [%.1f %%]” { channel=“deconz:humiditysensor:homeserver:00158d00047b8219010405:humidity” }

I tried different operators like “=>” and “70.0” or “70.00” but anyways the IF is not used.
Also, I checked if the “SteckdoseBadUnten.sendCommand(ON)” works → yes it works without the if.

So my Problem is the IF i dont know why the Numbers are not accepted.

Have u guys any help for me ?

I would be very grateful if someone can help or give me any tips.

Greetings from Bavaria,
Kahzia

Your Item is a Quantity type, has units, and will have a state like 65%
You can’t compare that with 70 - 70 what, apples or oranges?
You can compare it with another Quantity

if (BadLuftfeuchtigkeit.state > 70 | %) {

1 Like

thanks for that,

i didnt thought that the “%” is queried.
Anyways it worked well !

Thank u very much for the help

Greetings

The units are part of the state, and are used in comparisons.
Example, an Item:Length with state of 1500 m can be compared with 2 km, and it will be “less”.

1 Like