Rules MainUI: But only IF Temperature

I don’t know if this is the case here, but comparing temperatures can be tricky. See this;
Working with Number:Temperature Items in rules - Tutorials & Examples - openHAB Community

In my DSL rule I have to use this
var upsetpointnow = (UpstairsThermostat21_SetpointCooling.state as QuantityType<Temperature>).toUnit("°F")

to compare setpoints