Tarrifs price from fix to variable

Hello, i need help for setting one place that will contain price for peek and offpeek price so that, if price change i dont have to do it one by one for all my sensors and i can just change it in one place. At the moment i have it setu like this and it works, but how do i replace fix price with some sort of variable

sensor:
  - platform: template
    sensors:
      dnevni_trosak_klima:
        friendly_name: "Dnevni Trosak klima"
        unit_of_measurement: '€'
        value_template: "{{ (states('sensor.dnevna_potrosnja_klima_vt') | float * 0.157003 + states('sensor.dnevna_potrosnja_klima_nt') | float * 0.080965) | round(2) }}"

So how do i replace 0.157003 and 0.080965 with variable or somthing else

Use two input_numbers.

I have to admit that I don’t really know how to use that information, can you explain it to me a bit

Create two:

Put them in your dashboard. Put your prices in them.

Use them in your template the same way you would use a sensor:

 value_template: "{{ (states('sensor.dnevna_potrosnja_klima_vt')|float(0) * states('input_number.foobar')|float(0) + etc...

So in nutshell i just need to replace in my code this parts from

float * 0.157003 and float * 0.080965

to

float(0) * states('input_number.foobar')|float(0)

I presume that this foobar name needs to be same as name in input number helper

Yes. That was just an example.

Im testing input number helper in energy dashboard so that i dont mess up my yaml config, but im facing problem energy cost is in - and not +, i dont know what i did wrong





That is correct. Negative means you owe money.

Now that day reseted price is in + and correctly calculated, to bad that enegry dashboard update interval is not in real time

If you want a real time (power) card almost identical to the energy flow card, check this out: