As written in my previous post #328830 I used Integration - Riemann sum integral and Utility Meter to build the values for the new energy dashboard.
Now I have several smart plugs, which leads to multiple entries in my sensors.yaml and configuration.yaml.
sensors.yaml:
- platform: integration
source: sensor.energy_05_wattage
name: energy_05_spent
unit_prefix: k
round: 3
method: left
- platform: integration
source: sensor.energy_06_wattage
name: energy_06_spent
unit_prefix: k
round: 3
method: left
- platform: integration
source: sensor.energy_09_wattage
name: energy_09_spent
unit_prefix: k
round: 3
method: left
- platform: integration
source: sensor.energy_10_wattage
name: energy_10_spent
unit_prefix: k
round: 3
method: left
- platform: integration
source: sensor.energy_strip_02_wattage
name: energy_strip_02_spent
unit_prefix: k
round: 3
method: left
configuration.yaml
# Utility Meter
utility_meter:
daily_energy_05:
source: sensor.energy_05_spent
cycle: daily
monthly_energy_05:
source: sensor.energy_05_spent
cycle: monthly
daily_energy_06:
source: sensor.energy_06_spent
cycle: daily
monthly_energy_06:
source: sensor.energy_06_spent
cycle: monthly
daily_energy_09:
source: sensor.energy_09_spent
cycle: daily
monthly_energy_09:
source: sensor.energy_09_spent
cycle: monthly
daily_energy_10:
source: sensor.energy_10_spent
cycle: daily
monthly_energy_10:
source: sensor.energy_10_spent
cycle: monthly
daily_energy_strip_02:
source: sensor.energy_strip_02_spent
cycle: daily
monthly_energy_strip_02:
source: sensor.energy_strip_02_spent
cycle: monthly
Is there any opportunity to reduce the number of code lines and combine them?
red