Question syntaxe yaml

Bonjour,
Je m’adresse aux experts de la syntaxe yaml. Ce point reste souvent un mystère pour moi.
J’ai créé un template energy_meter avec la syntaxe ci-dessous:

    - name: "Autre électricité"  #Calcul consommation électricité autre que prises connectées
      unique_id: autre_electricite
      unit_of_measurement: "kWh"
      device_class: "energy"
      state_class: "total_increasing"
      state: "{{ states('sensor.lixee_zlinky_summation_delivered')|float - states('sensor.tz3000_2putqrmw_ts011f_summation_delivered_2')|float - states('sensor.tz3000_2putqrmw_ts011f_summation_delivered_3')|float - states('sensor.tz3000_2putqrmw_ts011f_summation_delivered_4')|float - states('sensor.tz3000_2putqrmw_ts011f_summation_delivered_5')|float - states('sensor.tz3000_2putqrmw_ts011f_summation_delivered_6')|float - states('sensor.tz3000_2putqrmw_ts011f_summation_delivered_7')|float - states('sensor.tz3000_2putqrmw_ts011f_summation_delivered_8')|float - states('sensor.chambre_parents_energie')|float}}"
      availability: "{{ states('sensor.tz3000_2putqrmw_ts011f_summation_delivered_5') not in ['none', 'unknown', 'unavailable'] }}"

Pas de soucis, ça fonctionne. Par contre, ce n’est pas très lisible, et j’aimerais pouvoir couper cette longue ligne state.

Merci d’avance

Salut,
tu peut faire dans ce genre:

    - name: 'Energie home instentané'
      unique_id: energy_home_instentane
      unit_of_measurement: "W"
      state: >-
          {% set SUM = states('sensor.zlinky_current_summation_derived_one_minute')|int(0) %}
          {% set BP = states('sensor.0x54ef4410005647e8_power')|int(0) %}
          {% set B2P = states('sensor.0xa4c1388dad871064_power')|int(0) %}
          {% set FP = states('sensor.0xa4c1383a5eeb5542_power')|int(0)  %}
          {% set PP = states('sensor.0xa4c138244f6e91e3_power')|int(0)  %}
          {% set TP = states('sensor.0xa4c138d4c17833b3_power')|int(0)  %}
          {% set EP = states('sensor.0xa4c138b1bfb7f7ef_power')|int(0)  %}
          {% set CBP = states('sensor.0x54ef4410004ea988_power')|int(0)  %}
          {% set MLP = states('sensor.0xa4c138c9cc1b6472_power')|int(0)  %}
          {{ SUM - ( BP + B2P + FP + PP + TP + EP + CBP + MLP ) |int(0) |round(0) }}