Skip to content

Instantly share code, notes, and snippets.

@lennon101
Last active July 8, 2024 04:54
Show Gist options
  • Save lennon101/53aa770aea9db00cd731b51bd910885b to your computer and use it in GitHub Desktop.
Save lennon101/53aa770aea9db00cd731b51bd910885b to your computer and use it in GitHub Desktop.
template sensor for total power
sensor:
- platform: template
sensors:
total_energy:
friendly_name: "Total Energy"
unit_of_measurement: 'Wh'
value_template: >
{% set device_a_energy = states('sensor.device_a_energy') | float %}
{% set device_b_energy = states('sensor.device_b_energy') | float %}
{% set device_c_energy = states('sensor.device_c_energy') | float %}
{{ (device_a_energy + device_b_energy + device_c_energy) | round(2) }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment