Sensor price update for energy metering

Good evening, I wanted to create a senior Kwh cost that is updated according to the time and color of my tempo subscription. I created the sensor below but it doesn’t update and I can’t find any errors in the logs! Can you help me ? Is there a spelling error?

  - platform: template
    sensors:
      current_electricity_cost:
        value_template: >-
          {% set t = strptime(states('sensor.time'), '%H:%M') %}
          {%- if t.hour >=22 and t.hour <6 and is_state('sensor.tempo_aujourd_hui', 'TEMPO_BLEU') -%}0.0862
          {%- elif t.hour >=22 and t.hour <6 and is_state('sensor.tempo_aujourd_hui', 'TEMPO_BLANC') -%}0.1112
          {%- elif t.hour >=22 and t.hour <6 and is_state('sensor.tempo_aujourd_hui', 'TEMPO_ROUGE') -%}0.1222
          {%- elif t.hour >=6 and t.hour <22 and is_state('sensor.tempo_aujourd_hui', 'TEMPO_BLEU') -%}0.1272
          {%- elif t.hour >=6 and t.hour <22 and is_state('sensor.tempo_aujourd_hui', 'TEMPO_BLANC') -%}0.1653
          {%- elif t.hour >=6 and t.hour <22 and is_state('sensor.tempo_aujourd_hui', 'TEMPO_ROUGE') -%}0.5486
          {%- endif -%}
        friendly_name: Current Electricity Cost
        unit_of_measurement: €/kWh

Thank you