How to model loads hierarchically? (Mains, Circuits, devices, etc.)

I’m relatively new to the ecosystem and am trying to use Home Assistant to diagnose and monitor energy use in a fairly complicated residential building (multiple sub-panels and lots of circuits).

I’ve found ways to create a bunch of energy-related entities, such as:

  • total energy consumed each hour, according to the utility
  • power monitor installed in the main breaker panel (e.g., iotawatt) – which will give me entities for the power/energy being consumed from the mains/grid and entities for consumption by each subpanel
  • power monitors installed in the sub panels (e.g., another iotawatt) – which will give me entities for the power/energy being consumed by select circuits (not enough sensors to attach to every circuit)
  • smart plugs installed on select high-load devices (e.g., some appliances/heaters)

Is there any way for me to “teach” home assistant about the relationships between these different sometimes-nested loads? I.e., I’d like to be able to enter the hierarchy containing facts like: “basement dehumidifier” entity is part of the load on “circuit 22” which is part of the load on “Subpanel B” which is part of the load on “power in from Grid”? (I’m not asking for Home Assistant to automatically figure out the relationships, only to be able to model it logically once I’ve entered it.) Then hopefully I’d be able to calculate/visualize consumption including things like “everything else on circuit 22 (i.e., circuit 22 entity minus dehumidifier entity)” or “total of all of the circuits on Subpanel B that don’t have a monitor attached to them” etc.

The reason it would be helpful to do this is the following: it would be insane/impossible to attach a smart plug to every single electricity-consuming device in the building, and it’s prohibitive to even attach monitors to every single circuit. So I need to prioritize, e.g., attach monitors to the handful of carefully-chosen most important circuits and maybe put smart plugs on the most-significant individual devices. But this leaves a lot of “everything elses” that it would be super helpful to be able to calculate and measure to try to discover energy wasters or places where I might need to install additional monitors…

Thanks!

1 Like

Home Assistant doesn’t have a built-in way of doing this, but you could create it with some complex scripts and templates. Or, what I do, is use Powercalc and use groups with it to achieve the same thing. You can add the same entity to multiple groups to create your hierarchy.

I use this to track by rooms so I know what each room is consuming but the grouping capabilities of Powercalc are excellent and I think would work for what you are looking to do.

Thanks so much for the pointer, @CO_4X4 , I’ll look into Powercalc!

You should also look into customization (customize:) configuration for Home Assistant. With customization, you can add arbitrary attributes to physical or template sensors (e.g. parent_entity to model your electric grid). Through these attributes you can model arbitrary complexity directly within Home Assistant. You can then query these attributes via Jinja templates to generate trees of sensors that can then be displayed as you see fit, and aggregate consumption this way. None of this is out-of-the-box, but it is certainly buildable.