Power budget gauge

Hi All,

I am trying to create a gauge that shows the available power budget for this month.
The P1 port is connected and shows the usage in kWh.
Than i have made 12 input numbers with the correct power budget.

Now i would like to display the difference in a gauge card. I was thinking to let the value be calculated via a template sensor.

  - platform: template
    sensors:
      usagebudget:
        value_template: '{{ ((float(states.input_number.powerbudgetjan.state)) - (float(states.sensor.power_consumption.state))) | round(2) }}' 
        unit_of_measurement: 'kWh'
        friendly_name: 'Power budget'
        icon_template: "mdi:flash"

I do not know how to get the correct input_number in the template without having to change it every month. (Right now the name of the input_number is "powerbudgetjan, powerbudgetfeb, enz enz). Does anybody have tips for me?

Thank you!

Geert

Maybe rename the input_numbers to powerbudget1, powerbudget2,…
You can get the number with

{{ now().month }}

No clue if you can build the template for the sensor with it.
Go to Dev Tools/templates and play with it.