[SOLVED] Another rule for Temperature

hello, i’m trying to add a rule to notify on my mobile device when the temperature in the main room is going down below 20°C, but it doesn’t work.

this the rule:

rule "Notifica abbassamento temperatura sala"

     Item iSala_Actual_Temp changed
     if ( iSala_Actual_Temp.state < 20 )
         logInfo("AbbassamentoTemperatura", "Temperatura sotto i 20")
         sendBroadcastNotification("La temperatura di casa sta cadendo a picco")

and this is how the item is configured:

Number:Temperature iSala_Actual_Temp "Sala [%.1f °C]" <temperature> (gTermostatoSala, gSala, gTemperature) [ "CurrentTemperaemperature" ] { channel="openwebnet:bus_thermostat:LCD:TermostatoSala:temperature" }

i’ve checked in openhablog but i doesn’t see any log reporting error or info :exploding_head:

please can anyone help me?

thanks a lot!

roule is ok
remove :Temperature from item

Number iSala_Actual_Temp "Sala [%.1f °C]" <temperature> (gTermostatoSala, gSala, gTemperature) [ "CurrentTemperaemperature" ] { channel="openwebnet:bus_thermostat:LCD:TermostatoSala:temperature" }
1 Like

yeah! that’s right! great!

thank you!

There is of course a way to keep the Number:Temperature definition and do the numeric comparison

if ( (iSala_Actual_Temp.state as QuantityType<Number>).doubleValue < 20 )


never seen a syntax like that! i will try if also this works :slight_smile:

thanks a lot!

It seems quite clumsy to me, but appears to be the way to get 22.1 out of 22.1°C
The QuantityType<Number> is the de-temperature-izing part, but why that doesn’t give a straight Number type I do not know.

1 Like

Thanks that worked a treat for me.


Since that was posted, I now think it is better to do such comparisons using Quantity Type units

if ( iSala_Actual_Temp.state < 20 | "°C")

this will do a correct comparison taking account of units e.g. if the item state is 35°F it will correctly see that as less than 20°C

1 Like