Created
March 19, 2023 12:09
-
-
Save jannickfahlbusch/92be92952a86a45fda4dc8c4eafeb314 to your computer and use it in GitHub Desktop.
Overall Power Home Assistant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template: | |
| sensor: | |
| - name: Overall Power | |
| unit_of_measurement: "W" | |
| device_class: energy | |
| state_class: measurement | |
| state: > | |
| {% set ns = namespace(states=[]) %} | |
| {% for s in states.sensor %} | |
| {% if s.object_id.endswith('_power') and not s.object_id == "overall_power" %} | |
| {% set ns.states = ns.states + [ s.state | float(0) ] %} | |
| {% endif %} | |
| {% endfor %} | |
| {{ ns.states | sum | round(2) }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment