Energy Consumption In Grafana

Posted on
Wed Nov 11, 2020 9:18 am
Sharek326 offline
User avatar
Posts: 377
Joined: Jul 20, 2014
Location: Lansford, PA

Energy Consumption In Grafana

Has anyone attempted to build anything out in Grafana focusing on energy cost. For example if you have a Aeon Labs Energy Meter and are already capturing the usage is there a way to build the graph to identify daily weekly or even monthly energy cost. Im kinda new to using this and trying to dip my toe in.

Posted on
Tue Jan 05, 2021 9:49 pm
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Re: Energy Consumption In Grafana

I know this reply is late, but I am doing something similar with my TED energy monitor. Very high level, this is what I am doing:

FOR DAILY USAGE
1. I have a schedule to run every 1 second that queries the energy usage and writes this value to a variable (temp_running_usage)
2. I have another schedule that runs every 1 second that takes that variable, divides by 3600, and writes that to another variable (true_running_usage)
3. I have another schedule that resets both variables at Midnight
4. I have Grafana look at the true_running_usage variable

FOR DAILY COST
1. First I have a variable that is our electricity rate. Since we are on Time of Use, I have a schedules that update that rate at the appropriate times and dates (current_rate)
2. I then have a schedule that runs every 1 second that takes the true_running_usage variable above and multiplies it by the current_rate, and writes this to another variable (current_cost)
3. I have Grafana look at the current_cost variable

I found it important to have all the values use at least 4 digits on the right of the decimal to keep things accurate.

I attached a few Grafana dashboard & config screenshots. I also have a near real time dashboard for my phone which I have included.

I can share all the Python that lives in the different schedules, and appropriate screenshots if you like.

Screen Shot 2021-01-05 at 6.54.00 PM.jpeg
Screen Shot 2021-01-05 at 6.54.00 PM.jpeg (180.54 KiB) Viewed 4747 times


Screen Shot 2021-01-05 at 7.46.34 PM.jpeg
Screen Shot 2021-01-05 at 7.46.34 PM.jpeg (54.6 KiB) Viewed 4747 times


IMG_1517 (1).jpeg
IMG_1517 (1).jpeg (60.83 KiB) Viewed 4747 times


Screen Shot 2021-01-05 at 6.54.41 PM.jpeg
Screen Shot 2021-01-05 at 6.54.41 PM.jpeg (165.32 KiB) Viewed 4747 times


Screen Shot 2021-01-05 at 6.54.20 PM.jpeg
Screen Shot 2021-01-05 at 6.54.20 PM.jpeg (180.99 KiB) Viewed 4747 times

Posted on
Wed Jan 06, 2021 8:36 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Energy Consumption In Grafana

Hi Chris,
Those look great. Would love to see more on how you do the script.

My aeon reports power only every 30 seconds. Does running it every second cause performance issues in indigo? I will at somepoint get a smart meter, once lockdown ends hopefully, and can then run this more frequently also with live electricity pricing, using the Octopus plugin.

Thanks

Simon.

Posted on
Wed Jan 06, 2021 8:59 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Energy Consumption In Grafana

Trying to replicate this myself with simple schedule and using Grafana.

One question, by taking the last in your examples below, is your script aggregating the values rather than just writing the current energy usage, otherwise you would be getting last reading in that period and not actual total?

Posted on
Wed Jan 06, 2021 10:50 am
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Re: Energy Consumption In Grafana

siclark wrote:
Trying to replicate this myself with simple schedule and using Grafana.

One question, by taking the last in your examples below, is your script aggregating the values rather than just writing the current energy usage, otherwise you would be getting last reading in that period and not actual total?


I have to do both.

I looked through all my schedules, and I forgot some things.

I have 3 "base" variables: Current Rate, Current Usage, and Current Cost which get updated every 1 second from Schedules (some use Python).

Then I have 2 schedules for Daily Total Usage, and 2 for Daily Total Cost, where the first is the raw number, and second I divide by 3600 to get the real number.

All the inline Python scripts embedded in the Schedules are shown below.

Also, I have crossed referenced the data with reading directly from my TED device, since there is a plugin to do that, and it always matches pretty much down to the penny (or kWh). I do realize I am using 2, 3, and 4 decimals in places, and I might need to revisit that, but so far so good.

Another FYI: I haven't had too many issues running all these embedded Python scripts that frequently, though I may move all them to external .py files.

ELECTRICITY RATE
No Python needed. I have several intricate date & time based schedules to update the variable for "Rate", Indigo ID 1271206538

ELECTRICITY USAGE
Code: Select all
# -*- coding: utf-8 -*-
import indigo
import requests
import math
import urllib
import re
import xml.etree.ElementTree as ET

#TED Dashboard GET - It is very messy, but works
response = requests.get('http://192.168.20.90/api/DashData.xml')
requestURL = 'http://192.168.20.90/api/DashData.xml'
root = ET.fromstring(response.content)
now = response.content.split('\n')[1]
now = re.sub("<Now>","",now)
energyNow = float(now.split('<')[0])
energyNow = energyNow/1000
indigo.variable.updateValue(108813449, u"{0:.3f}".format(energyNow))


ELECTRICITY COST
Code: Select all
#! /usr/bin/env python
# -*- coding: utf-8 -*-
kwh = float(indigo.variables[108813449].value)
rate = float(indigo.variables[1271206538].value)
cost = kwh * rate
indigo.variable.updateValue(1493589605, u"{0:.2f}".format(cost))  # variables must be stored as strings / 1 decimal


DAILY TOTAL USAGE 01
Code: Select all
#! /usr/bin/env python
currentElectricityUsage = indigo.variables[108813449]
tedRunningTotalUsage = indigo.variables[1283246615]
newValue = currentElectricityUsage.getValue(float) + tedRunningTotalUsage.getValue(float)
# Stuff the new value back into one of the variables (tedRunningTotalUsage in this example):
indigo.variable.updateValue(tedRunningTotalUsage, u"{0:.4f}".format(newValue))


DAILY TOTAL USAGE 02
Code: Select all
#! /usr/bin/env python
tedRunningTotalUsage = indigo.variables[1283246615]
tedRunningTotalUsage2 = indigo.variables[113926384]
newValue = tedRunningTotalUsage.getValue(float) / 3600
indigo.variable.updateValue(tedRunningTotalUsage2, u"{0:.4f}".format(newValue))


DAILY TOTAL COST 01
Code: Select all
#! /usr/bin/env python
currentElectricityCost = indigo.variables[1493589605]
tedRunningTotalCost = indigo.variables[163627038]
newValue = currentElectricityCost.getValue(float) + tedRunningTotalCost.getValue(float)
# Stuff the new value back into one of the variables (tedRunningTotalCost in this example):
indigo.variable.updateValue(tedRunningTotalCost, u"{0:.2f}".format(newValue))

DAILY TOTAL COST 02
Code: Select all
#! /usr/bin/env python
tedRunningTotalCost = indigo.variables[163627038]
tedRunningTotalCost2 = indigo.variables[1726430330]
newValue = tedRunningTotalCost.getValue(float) / 3600
indigo.variable.updateValue(tedRunningTotalCost2, u"{0:.4f}".format(newValue))

Posted on
Wed Jan 06, 2021 11:38 am
neilk offline
Posts: 714
Joined: Jul 13, 2015
Location: Reading, UK

Re: Energy Consumption In Grafana

Not strictly speaking done in Indigo (the script to refresh it is via a schedule) but this is taken from data pulled into the same Influx/Grafana instance that Indigo uses that pulls data from my energy providers API. I may look to do the same for the Glowmarkt/Hildebrand as then any UK smart meter users with a SMETS2 meter could do the same without needing to be on Octopus Energy with a free "Glow" account. This also calculates the effective price per kWh and this is December and over the last 9 months this would be 11p per kWh, and compares to their Go tariff which is a fixed rate, but with a low cost period through the night. UK users only I am afraid.

Screenshot 2021-01-06 at 17.31.03.png
Screenshot 2021-01-06 at 17.31.03.png (456.24 KiB) Viewed 4686 times

Posted on
Wed Jan 06, 2021 11:58 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Energy Consumption In Grafana

Cheers Neil.. Yes this is where I want to get to with the logging, ideally before I switch to their smart tariff so I can compare current cost vs cost on their smart tariff. However for now I am on Aeon local power sensor (every 30 seconds) rather than SMETS2 and with new lockdown it will be a while before I get one.

However I also want to drill into drivers of the usage. so Chris's detial is also very useful. Ideally I want to take those total cost bars and split them into known (ie underfloor heating, lights etc) where I have accurate use, and unknown and by time of day so I can look for areas to reduce.
I already know my standing use is too high (which is why I am interested in Octopus smart as I should pay less for that over night than I do now.

The Go tariff sounds interesting too but probably I dont use enough in those hours without an electric car. .

Posted on
Wed Jan 06, 2021 12:07 pm
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Re: Energy Consumption In Grafana

siclark wrote:
Cheers Neil.. Yes this is where I want to get to with the logging, ideally before I switch to their smart tariff so I can compare current cost vs cost on their smart tariff. However for now I am on Aeon local power sensor (every 30 seconds) rather than SMETS2 and with new lockdown it will be a while before I get one.

However I also want to drill into drivers of the usage. so Chris's detial is also very useful. Ideally I want to take those total cost bars and split them into known (ie underfloor heating, lights etc) where I have accurate use, and unknown and by time of day so I can look for areas to reduce.
I already know my standing use is too high (which is why I am interested in Octopus smart as I should pay less for that over night than I do now.

The Go tariff sounds interesting too but probably I dont use enough in those hours without an electric car. .


Just one note on the Go tariff, which sounds like an EV Time of Use plan similar to what we have here in California, though ours seems fairly generous, since my specific plan is not limited to just the EV charging port, but includes the wholehouse.

Super Off-Peak $0.09/kWh, which is very, very cheap for California:
Weekdays Midnight-6am
Weekends Midnight-2pm

We got an EV 2 years ago and switched to our local TOU plan, and I have to say that although charging our car is much cheaper this way, we now change our habits so things like Dishwashers, Washing Machines, 3D printing, even AC during the summer, are run during those cheaper times. On average, we have saved about $500 per year this way over previous years.

So you might want to look into it, before dismissing it.

Posted on
Wed Jan 06, 2021 12:18 pm
neilk offline
Posts: 714
Joined: Jul 13, 2015
Location: Reading, UK

Re: Energy Consumption In Grafana

You are spot on with Agile being good if you have a high base load, but with an EV and a little behavioural change (delay start on washing machine, dishwasher) etc it can work really well.

Having said that the rates today are terrible, almost all higher than even a normal Big 5 rate all day and hitting the 35p cap, but the market is doing some strange stuff with lockdown, low wind, some nuclear offline and high demand across europe meaning they have to bring more coal online as they cannot get surplus from the European Interconnects.

On the upside for those with Solar or batteries the export rates are also sky high.

Back to the main topic, I am considering joining the beta programme for https://octopus.voltaware.com which looks really interesting and frankly sounds too good to be true, they basically measure the electrical noise across your supply and then "disaggregate" this to identify individual appliances without having to energy monitor them independently (at least for certain load types). Tempted to just order one and have a play, and potential for another plugin !

Posted on
Wed Jan 06, 2021 12:20 pm
neilk offline
Posts: 714
Joined: Jul 13, 2015
Location: Reading, UK

Re: Energy Consumption In Grafana

sumocomputers wrote:
ust one note on the Go tariff, which sounds like an EV Time of Use plan similar to what we have here in California, though ours seems fairly generous, since my specific plan is not limited to just the EV charging port, but includes the wholehouse.


It is indeed the same, the rate is effective for all consumption based on Time of use on both the Agile and Go options

Posted on
Wed Jan 06, 2021 12:57 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Energy Consumption In Grafana

neilk wrote:

Back to the main topic, I am considering joining the beta programme for https://octopus.voltaware.com which looks really interesting and frankly sounds too good to be true, they basically measure the electrical noise across your supply and then "disaggregate" this to identify individual appliances without having to energy monitor them independently (at least for certain load types). Tempted to just order one and have a play, and potential for another plugin !


That looks amazing. Although I think I read about similar product years ago, or maybe this was it. They do say they’ve been looking at this for 5 years.
Shame your own Electrcian can’t install it. Got a mate that could do it for a lot less than their installer would charge.

Posted on
Wed Jan 06, 2021 1:59 pm
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Re: Energy Consumption In Grafana

neilk wrote:
Back to the main topic, I am considering joining the beta programme for https://octopus.voltaware.com which looks really interesting and frankly sounds too good to be true, they basically measure the electrical noise across your supply and then "disaggregate" this to identify individual appliances without having to energy monitor them independently (at least for certain load types). Tempted to just order one and have a play, and potential for another plugin !


I am very curious how well this works. Sense promises something similar (not sure if it uses electrical noise), but is largely disappointing when it comes to identifying appliances (as in it doesn't really work for much other than things like Refrigerators that have a steady and repeatable pattern).

I ended up using those little TP-Link smart power outlets that also monitor energy, and plug them into things I know have the potential to use large amounts of energy. In my case Fridge, Furnace Blower, Mac Mini, Washer & Dryer. At less than $20 a piece, they started as a throw away experiment, and I have come to love them.

Screen Shot 2021-01-06 at 11.58.05 AM.png
Screen Shot 2021-01-06 at 11.58.05 AM.png (485.58 KiB) Viewed 4624 times

Posted on
Wed Jan 06, 2021 3:11 pm
neilk offline
Posts: 714
Joined: Jul 13, 2015
Location: Reading, UK

Re: Energy Consumption In Grafana

siclark wrote:
Shame your own Electrcian can’t install it. Got a mate that could do it for a lot less than their installer would charge.


Reading the Octopus forum it looks like you can have any electrician fit it, a few issues with the size of the clamp being big enough to fit around the supply. Mine would need to go in my meter cabinet as I have three consumer units.

Think I might order one, they have a full rest API as well.

Neil

Posted on
Thu Jan 07, 2021 2:51 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Energy Consumption In Grafana

sumocomputers wrote:

I am very curious how well this works. Sense promises something similar (not sure if it uses electrical noise), but is largely disappointing when it comes to identifying appliances (as in it doesn't really work for much other than things like Refrigerators that have a steady and repeatable pattern).

I ended up using those little TP-Link smart power outlets that also monitor energy, and plug them into things I know have the potential to use large amounts of energy. In my case Fridge, Furnace Blower, Mac Mini, Washer & Dryer. At less than $20 a piece, they started as a throw away experiment, and I have come to love them.

Screen Shot 2021-01-06 at 11.58.05 AM.png


Maybe it was Sense that I read about a while ago. I heard the same.

I use those smart power outlets too for a lot of my devices, and the virtual energy plugin for devices that I know are on, ie electric underfloor heating, and smart bulbs, with known electricity usage,but where they dont report power.

However, be careful, I had a smart power outlet melt on me a little while ago which was connected to my drier. Now it might have been that the weight of the plug cord meant it wasnt quite seated correctly, so some gaffer tape might have helped, and the socket to be fair did cut out immediately, the damage was made worse by my not realising why the socket had turned off and my repeatedly turning it back on, but be careful on using these on appliances with high current requirements. .

Posted on
Thu Jan 07, 2021 10:10 am
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Re: Energy Consumption In Grafana

siclark wrote:
Maybe it was Sense that I read about a while ago. I heard the same.

I use those smart power outlets too for a lot of my devices, and the virtual energy plugin for devices that I know are on, ie electric underfloor heating, and smart bulbs, with known electricity usage,but where they dont report power.

However, be careful, I had a smart power outlet melt on me a little while ago which was connected to my drier. Now it might have been that the weight of the plug cord meant it wasnt quite seated correctly, so some gaffer tape might have helped, and the socket to be fair did cut out immediately, the damage was made worse by my not realising why the socket had turned off and my repeatedly turning it back on, but be careful on using these on appliances with high current requirements. .


I hear that.

A lot of appliances here in the US like furnaces and dryers, run on Natural Gas or Propane, so the electrical consumption is way below the max of the outlets (usually around 15A or 1800 Watts),

But it is definitely a weak point of the energy monitoring smart outlets: I don't know of any that offer high current draws, nor 240V with a US outlet for dryers, stoves, etc.

TED Energy Monitoring systems did offer something called "Spiders" that go in your electrical panel on each circuit breaker load. And while this can help narrow things down quite a bit, it still doesn't get to a per device granularity. And I do not recommend TED, as they haven't really updated their hardware offering or software in years, and recently got bought by another company, so I think their days are numbered.

Who is online

Users browsing this forum: No registered users and 1 guest

cron