Template trigger sensor conditional update

Feel silly now towards all of you helping me, adapting your examples trying to be smart. I have now removed the unavailibility section of the sensor and have not seen any jumps for some hours. Too early to say maybe that it will work flawlessly with that little testing but looks promising. Thanks guys for being persistant.

- trigger:
    - platform: state
      entity_id: sensor.temperature_boiler
  sensor:
    - name: Boiler Pellets Accumulated Temp Diff
      unit_of_measurement: "°C"

      state: >
        {% set diff = trigger.to_state.state | float(-1) - trigger.from_state.state | float(-7) %}
        {% 
           if     states('switch.burner_enabled') == "on" 
              and has_value('sensor.temperature_boiler')
              and trigger.to_state.state | is_number
              and trigger.from_state.state | is_number
        %}
          {{ this.state | float(5) + diff | float }}
        {% else %}
          {{ this.state }}
        {% endif %}