My conditions does not seems to work

Good day!

A bit newbie here… I am trying my best to setup the HVAC Mode of my thermostat to work like I want. Basically I want to cool if the current temp go 0.7 celcius over the set temp, to heat if go under 0.7, and off if in the range. The YAML doe not give any error, but the actions doe not occur at all… I suspect that I should write the conditions differently but I do not see how…

alias: Définir HVAC Salon
description: ""
triggers:
  - device_id: X
    domain: climate
    entity_id:X
    type: current_temperature_changed
    trigger: device
    above: 0.1
  - device_id: X
    domain: climate
    entity_id: X
    type: current_temperature_changed
    trigger: device
    below: 0.1
conditions:
  - condition: state
    entity_id: input_boolean.changement_hvac_autorise_salon
    state: "on"
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: ((states("sensor.mysa_X_current_temperature")>(state_attr('climate.mysa_X_thermostat','temperature') +0.7)))
        sequence:
          - device_id: X
            domain: climate
            entity_id:X
            type: set_hvac_mode
            hvac_mode: cool
      - conditions:
          - condition: template
            value_template: ((states("sensor.mysa_X_current_temperature")<(state_attr('climate.mysa_X_thermostat','temperature') -0.7)))
        sequence:
          - device_id: X
            domain: climate
            entity_id: X
            type: set_hvac_mode
            hvac_mode: heat
      - conditions:
          - condition: template
            value_template: ((states("sensor.mysa_X_current_temperature")<(state_attr('climate.mysa_X_thermostat','temperature') +0.7)))
          - condition: template
            value_template: ((states("sensor.mysa_X_current_temperature")>(state_attr('climate.mysa_X_thermostat','temperature') -0.7)))
        sequence:
          - device_id: X
            domain: climate
            entity_id: X
            type: set_hvac_mode
            hvac_mode: "off"
mode: single

Any Idea? Please let me know if I miss any important information to help… Thanks!

triggers only fire (once), only when the temperature goes over/under the limits.

if the temp is already under or over, the trigger does not fire. it does not keep firing when over/under.

also, if I read your yaml right, your trigger temp is set to 0.1c

set to the actual upper and lower temps you want to set (example upper 20.7c & lower 19.3c or whatever)

Thanks for the input! But… I also try just to execute the actions… And even with that, It did not execute at all…

In addition to what Saoshen mentioned about the triggers, the template conditions have several errors:

  • Templates must be surrounded by quotes or use a multi-line quote indicator.
  • Templates use curly braces, not parentheses, as their delimiters.
  • States are always strings, so you need to use a numeric filter like float or int if you are going to perform mathematics functions or comparisons.

Also opt to use state and other triggers/conditions over devices ones.