Question about multiple tariff on energy tab

Hello all, this is my first message on this group…

I integrated my energy meter with esp32 and sensors and reading the consumption for a while…

I wanted to add tariff to check my usage but we have 3 tariffs for different time of the day…

I created a configuration with help of chatgpt, everything seems logical but on my energy screen it calculates 1 TL for 1 kW and couldnt figure out what is wrong…

Sharing the code in configurations.yaml file about the calculation.
Am I missing something?

 - platform: rest
    name: Total Power
    unique_id:  phase_totalpwr1
    resource: http://192.168.1.248
    value_template: >-
      {% set power = value | regex_findall('<h2>Total Power:</h2>Total Power: (.*?) W') | first | float %}
      {{ ((power - 120) * 1.161) if power > 120 else 0 }}
    headers:
      User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
    scan_interval: 30
    unit_of_measurement: "W"
    state_class: measurement
    device_class: power
    
  - platform: template
    sensors:
      electricity_tariff:
        friendly_name: "Electricity Tariff"
        value_template: >
          {% set current_hour = now().hour %}
          {% if 6 <= current_hour < 17 %}
            3.15  # 06:00-17:00
          {% elif 17 <= current_hour < 22 %}
            4.62  # 17:00-22:00
          {% else %}
            1.97  # 22:00-06:00
          {% endif %}
        unit_of_measurement: "TL/kWh"

  # Template sensor to calculate electricity cost
  - platform: template
    sensors:
      electricity_cost:
        friendly_name: "Electricity Cost"
        value_template: >
          {% set power_watts = states('sensor.total_power') | float %}
          {% set power_kwh = power_watts / 1000 %}
          {% set tariff = states('sensor.electricity_tariff') | float %}
          {{ (power_kwh * tariff) | round(2) }}
        unit_of_measurement: "TL"

Problem might be related what i chosen on energy tab. I tried to add the tariff from energy screen but, there is only total_power under “use an entity tracking the total cost.” so it seems it is not getting the tariff as entity… how can i fix it?

Thnak you