Thermostat set temp returns nan if sensor disconnected

I have a local thermostat in my node. If the temp sensor is disconnected, in the web UI my text sensor returns nan but returns a correct target temp in the thermostat control UI

  - platform: template
    name: set_temp_text_sensor
    id: set_temp_text_sensor
    internal: false
    lambda: |-
      return to_string(id(controller).target_temperature);

is this a bug???
climates

Try

return {std::to_string(id(controller).target_temperature)};

Hey thanks for this, but Ive worked out what the problem was.

On a reflash of the node, id(controller).target_temperature sometimes has nothing in it, hence why it comes up with the error

Its a bug, but is overcome by changing the temp on the controller first