Statistics on Power Consumption

Posted on
Sat Nov 28, 2020 5:02 am
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Statistics on Power Consumption

Hello all,

is there a tool which can read the total (power) usage (of each device) to be sent to an email address? It would be great to have it in an Excel readable file to do some statistics.

Thanks in advance for your help.

Best regards

Bildhauer

Posted on
Sun Nov 29, 2020 2:00 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Statistics on Power Consumption

Try something like this python script (which can be executed as an embedded script action):

Code: Select all
emailTo = "user@somedomain.com"
emailBody = u"Device Name, Device ID, Last Reset Timestamp, Current Power (Watts), Total Energy (kWh)\n"
for dev in indigo.devices.iter("props.SupportsEnergyMeter"):
  emailBody += u"{}, {}, {}, {}. {}\n".format(dev.name, dev.id, dev.energyAccumBaseTime, dev.energyCurLevel, dev.energyAccumTotal)

indigo.server.sendEmailTo(emailTo, subject="Current Power Usage", body=emailBody)

Image

Posted on
Tue Dec 01, 2020 4:56 pm
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Statistics on Power Consumption

Ok, I'll try!

Posted on
Wed Dec 02, 2020 1:10 pm
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Statistics on Power Consumption

Hello Matt,

that was a good first step. Did you ever manage to send this kind of email and import this in to a given Excel sheet automatically, (e. g. with an automator script) so you can have a statistics based on the data which were received?

Thanks al lot in advance

Bildhauer

Posted on
Wed Dec 02, 2020 3:40 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Statistics on Power Consumption

No, I've never tried that.

Image

Posted on
Wed Dec 02, 2020 3:52 pm
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Statistics on Power Consumption

Ok,

is it possible to create an email similar to what you already suggested? It should make a 90 degree move so that each line represents a new time stamp and any column (to be separated by tabs instead of commas) represents the power consumption per device?

thx a lot in advance.

Best regards

Bildhauer

Posted on
Wed Dec 02, 2020 6:12 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Statistics on Power Consumption

Do you care about the individual power/energy usage for each device or do you just want the sum of all devices?

For the former you are going to run into issues if a new device gets added or a device is removed, in which case the order of the columns will all change.

If you just want the sum total of power consumed, then that can easily be calculated in the python script although doing it for each timestamp will be difficult. I think your script is going to have to assume that all of the devices have the same start timestamp (and thus they will all need to be reset at the same time, every month/week/day).

Image

Posted on
Thu Dec 03, 2020 6:24 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Statistics on Power Consumption

I've used the XlsxWriter Python module at work, but wouldn't say I'm qualified to explain how to use it. As I remember though, the docs were pretty straightforward.

https://xlsxwriter.readthedocs.io

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Dec 03, 2020 6:25 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Statistics on Power Consumption

p.s. that was in a Windows environment. I have zero experience using the library in an OS X environment.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed May 11, 2022 1:51 pm
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Statistics on Power Consumption

Hello,

does anyone have Python script to reset the power consumption of each device so it starts measuring again at zero?

Thanks in advance

Best regards

Bildhauer

Posted on
Wed May 11, 2022 2:46 pm
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Statistics on Power Consumption

Hello,

do you have an example script for me using this tool?

Bsst regards

Bildhauer

DaveL17 wrote:
I've used the XlsxWriter Python module at work, but wouldn't say I'm qualified to explain how to use it. As I remember though, the docs were pretty straightforward.

https://xlsxwriter.readthedocs.io

Posted on
Wed May 11, 2022 5:55 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Statistics on Power Consumption

Wow, that's a blast from the past. Unfortunately, I used that tool at work and I'm now retired. I don't have access to any of those scripts any longer. Sorry.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests

cron