How to detect (And set a default) for a NULL item value

10 isn’t a valid state for a Number:Temperature type.
It’s also best to use documented methods.
Entrance_Target_Temp.postUpdate("10 °C")

This might help remind you that postUpdate is asynchronous, it takes time to affect the actual Item and the rule does not stop and wait for that to happen.
Read the Item state in the next line, probably still get the old state.

That’s okay, you already know what you just posted to it. So use that instead.

In your case

  var myReading = Entrance_Target_Temp.state
  if (myReading == NULL ) {
    logInfo("Heating", "Set default entrance target 10")
    Entrance_Target_Temp.postUpdate("10 °C")
    myReading = 10 | °C
  }

Use == with NULL, it is very much not the same as null

2 Likes