I have this template code from climate
but states('sensor.AFB_desired_temp')
is unknown
temperature_high_command_topic: "AFB/JSONout"
temperature_high_state_topic: "AFB/JSONout"
temperature_high_state_template: >
{% if value_json is not none and "ThermostatOvertemp" in value_json %}
{{ value_json.ThermostatOvertemp|int + states('sensor.AFB_desired_temp')|int }}
{% else %}
0
{% endif %}