Help to tidy up energy templates (for standing charge and unit rate monitoring)

Hi there,

I’m in the UK and have a standing charge for electricity (daily) and unit rate. Unit rate seems to be calculated fine - but standing charge isn’t working.

At the moment this is my setup:

sensor.electricity_cost_today

{% set kwh = states('sensor.shellyem_channel_1_energy_cost') | float %}
{% set price_per_kwh = 0.2292 %}
{% set standing_charge = 0.4906 %}
{{ (kwh * price_per_kwh + standing_charge) | round(2) }}

sensor.standing_charge_electricity

{{ 0 }}
Unit of measurement: KwH
Device Class: energy
State class: Total

input_text.tariff_import_standing_charge_cumulative

sensor.tariff_import_standing_charge_cumulative

And then an automation setup:

alias: Electricity Standing Charge
description: ""
triggers:
  - trigger: time
    at: "00:00:01"
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
      - sun
conditions: []
actions:
  - action: input_number.set_value
    metadata: {}
    data:
      value: >-
        {{
        states('input_text.tariff_import_standing_charge_cumulative')|float(0)
        +  states('sensor.standing_charge_electricity')|float(0)}}
    target:
      entity_id: input_text.tariff_import_standing_charge_cumulative
mode: single

The automation’s action is the source of the problem.

It’s attempting to use an action meant for an Input Number (input_number.set_value) with an Input Text entity (input_text.tariff_import_standing_charge_cumulative).

Change the entity_id to an Input Number or, if it’s truly an Input Text entity you want to use, change the action to input_text.set_value.

1 Like

Brilliant - thank you!

Yes that was it.

1 Like