Ok I solved the problem, but I still do not understand why the following code work while the previous one does not
rule "heating water thermostat"
when
Item B_Temperature_Water_Setpoint changed or
Item B_Temperature_tgS_heating_water changed
then
var Number cur_temp = B_Temperature_tgS_heating_water.state
var Number setpoint = B_Temperature_Water_Setpoint.state
val hysteresis = 0.5
if ((cur_temp).floatValue < ((setpoint).floatValue - hysteresis)) {
if (boiler_outb0.state == OFF) {
sendCommand(boiler_outb1, OFF)
sendCommand(boiler_outb0, ON)
}
}
else {
sendCommand(boiler_outb0, OFF)
}
end