[Solved]Number:temperature does not work in if statement

OH 3.0

In a DSL V1 rule I have an if with this condition FF_MasterBedroom_Temperature.state < 21

All is Ok if I define item FF_MasterBedroom_Temperature as a number, but if I define it as number:temperature if always evaluates to false

I don’t know if this is a bug or if I’m doing something wrong.

If you define the item as Number:Temperature it is a quantity item. For comparison in DSL scripts you need to add the unit like that:

if (FF_MasterBedroom_Temperature.state < 21 | ℃)
    logInfo("my.rules", ...)

See the documentation on unit of measurements:

Units Of Measurement

the number item part of the documentation of rules:

Rules - Number Item

and this forum thread:

Working with Number:Temperature item type

for details.