Calculate energy consumption for an area / room / floor

Hi everybody,

I would like to sum up my power consumption for all devices in a room. Is there a way to use the room / area for grouping devices? Or do I have to group manually by templating or the utility meter options?

My idea to that is that you can either use something like the normal template entity, the mushroom template card to program a sum in your dashboard or the fancy version with the Sankey Chart.

Thanks for your reply. I do know sankey chart (and using it).
But what I want is a automated summary of power measured devices belonging to defined rooms/areas/floors.

For example: I have kitchen as a room in floor 1. Now I have several power consuming devices (fridge, coffe maschine, stove, freezer). They all deliver power and energy data.

I would now like to build a template which grabs these data and sum it up with the attribute “kitchen” or “floor 1”

I would then use this data in my own cards.

ChatGPT could help me (after a lot of discussion)

This sensor gives me all power form the Area “Küche” back as sum in W

- platform: template
  sensors:
    kuche_verbrauch:
      friendly_name: "Gesamtverbrauch Küche"
      unit_of_measurement: "W"
      value_template: >
        {% set kuche_verbrauch = namespace(total=0) %}
        {% for entity_id in area_entities('kuche') %}
          {% if 'power' in entity_id %}
            {% set entity_state = states(entity_id) %}
            {% if entity_state not in ['unknown', 'unavailable'] %}
              {% set entity_state_value = entity_state | float(0) %}
              {% if entity_state_value > 0 %}
                {% set kuche_verbrauch.total = kuche_verbrauch.total + entity_state_value %}
              {% endif %}
            {% endif %}
          {% endif %}
        {% endfor %}
        {{ kuche_verbrauch.total }}
1 Like