#Inferring energy usage from other HomeAssistant sensors

1 messages · Page 1 of 1 (latest)

wild stirrup
#

I have smart lights which report their on/off status and % on/power in HA.

Given they all have the same bulbs (4W I think), would it be possible to estimate their power usage and show this in HA's energy view?

E.g.

total_power=0
for light in lights:
  if light.status == "on":
    total_power=+(4*light.power_level)

Then I could use a template to turn power into energy for the daily view.

Has anyone tried this? Is this a bad idea?

void pelican
void pelican
wild stirrup
void pelican
#

"Abbott and Costello" Style jokes aside...powercalc is probably what you are looking for 😛
I haven't used it personally but am aware of it and its on my list of things to mess with "at some point".

wild stirrup
#

Yeah it looks like exactly what I'm looking for

#

I guess I finally need to get HACS setup

void pelican
#

What type of HA install do you have HAOS or Container?

wild stirrup
#

Container

void pelican
#

You just drop into the container shell pull and run a script then restart the container and can add the HACS integration.

wild stirrup
#

I was and am hesitatnt about linking my GitHub, not from a security perspective but more from a separation/privacy side

#

But I don't think there are other options 🙁

void pelican
void pelican
#

If it used a generic API key to pull data and download stuff then it would get blocked due to limits.

#

Prior to V2 It did pull some stuff via a generic key I think but it became unsustainable and made GitHub a bit angry.

mortal apex
wild stirrup
#

Now my problem is that I have installed PowerCalc and it is working. I've set it up on 3 bulbs and added them to my energy calculations/dashboard

#

But these bulbs use like 0.005KWh per day, and I have 30+ of them, so I would prefer to group them into a single lighting entity than have this individual device usage be flooded with entity so I can't see the real power users.

#

Any ideas on how to do that?

#

E.g. this doesn't scale for 30-40 bulbs

void pelican
# wild stirrup But these bulbs use like 0.005KWh per day, and I have 30+ of them, so I would pr...

Create a sensor group helper of type "Sum" then add all your bulb individual energy entities to this group. then you will have an entity which is the summed power use of all the bulbs. you can then add this to the energy dashboard instead instead of all the individual ones. that way instead of spam you just get "My awesome big group of bulbs" (or whatever more appropriate name you select for your group).

wild stirrup
#

Thanks, I've given this a try

#

Do you know if there is a way to sum an attribute for all devices with a given tag rather than adding them manually?

wild stirrup
#

This looks like what I want but I need to figure where/how to write that

void pelican
# wild stirrup Do you know if there is a way to sum an attribute for all devices with a given t...

If you want to do it a semi-lazy way then you could install this from HACS:
https://github.com/gjohansson-ST/attribute_as_sensor
That allows you to create helpers that break out attributes into their own sensors then you could just use the a sum group on them...

GitHub

Home Assistant use an entity's attribute as a new sensor helper - gjohansson-ST/attribute_as_sensor

lethal vortex
wild stirrup
wild stirrup