Multiple Template Sensor using Wildcards for Daily / Weekly / Monthly Cost

Hi all,

I’ve created the below sensors for daily cost, and want to do the same for weekly and monthly costs.

I’m planning on creating a counter to account for Weekly / Monthly Energy and then repeat the sensor calculation below.

To get to my point; It is possible to use wildcards to generate a sensor for every entity that ends daily / weekly / monthly energy respectively ( and avoid 8+ individual entry’s)?

It would also have the advantage of automatically adding a Daily / Weekly / Monthly cost sensor when a new Energy sensor is added


  - sensor:
      - name: Washing Machine Daily Cost
        unique_id: 48892-ysi
        device_class: monetary
        state_class: measurement
        unit_of_measurement: GBP
        state: "{{ (states ('sensor.washing_machine_energy_monitor_daily_energy') | float * (states('sensor.octopus_energy_electricity_19p6208836_1300007945181_current_rate') | float)) }}"

      - name: Server Daily Cost
        unique_id: 75326-jfq
        device_class: monetary
        state_class: measurement
        unit_of_measurement: GBP
        state: "{{ (states ('sensor.server_power_monitor_daily_energy') | float * (states('sensor.octopus_energy_electricity_19p6208836_1300007945181_current_rate') | float)) }}"

      - name: Drier Daily Cost
        unique_id: 98356-phf
        device_class: monetary
        state_class: measurement
        unit_of_measurement: GBP
        state: "{{ (states ('sensor.tumble_drier_energy_monitor_daily_energy') | float * (states('sensor.octopus_energy_electricity_19p6208836_1300007945181_current_rate') | float)) }}"

      - name: Dishwasher Daily Cost
        unique_id: 04326-pjd
        device_class: monetary
        state_class: measurement
        unit_of_measurement: GBP
        state: "{{ (states ('sensor.dish_washer_energy_monitor_daily_energy') | float * (states('sensor.octopus_energy_electricity_19p6208836_1300007945181_current_rate') | float)) }}"
        

Thanks in advance