Efergy Engage Hub - Power Usage

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
jckruger
Posts: 7
Joined: Wed Jun 17, 2015 6:56 pm

Efergy Engage Hub - Power Usage

Post by jckruger »

I have just created a template and associated shell script to graph the power usage from my Efergy engage hub. You can use different scripts to get the value depending on the system that you use of scripting language you want to use so longs as you get the value you want. This link will allow you to test the different types of scripts

http://docs.energyhiveapi.apiary.io/#re ... uessummary

The script that I have used is this:

Code: Select all

#!/bin/bash
energy=`curl 'http://www.energyhive.com/mobile_proxy/getCurrentValuesSummary?token=xxxxxxxxxxxxxxxxx'`
echo $energy |cut -f4 -d":"|cut -f1 -d"}"
Put the script in the <cacti>/scripts folder and name it EfergyAPIJson.sh

Make sure you update the script to have your token

Works really well for me. Hope it works for you

If anyone knows of a way to interrogate the hub directly instead of scraping from the website I would be interested. I have tried sniffing the traffic using wireshark but can't see exactly the data I can extract. Efergy won't tell me how it can be done I guess to protect their product useability :(

Regards
Justin Kruger
Attachments
cacti_graph_template_efergy_engage.zip
(2.04 KiB) Downloaded 188 times
Screenshot
Screenshot
Engage - Energy Consumption.jpg (120.54 KiB) Viewed 3528 times
bazza
Posts: 2
Joined: Tue May 24, 2016 10:51 am

Re: Efergy Engage Hub - Power Usage

Post by bazza »

Hello jckruger,

I've been playing around with the getTimeSeries Function:

Code: Select all

http://www.energyhive.com/mobile_proxy/getTimeSeries?&fromTime=1464048000&toTime=1464105773&aggPeriod=minute&aggFunc=sum&offset=0&token=xxxxxxx
To my mind this should be equivalent-ish to:

Code: Select all

http://www.energyhive.com/mobile_proxy/getDay?&token=xxxxxx
However I'm getting different results. For getTimeSeries I'm getting

Code: Select all

{
    "status":"ok",
    "data":
    {
        "1464048000000":[0],
        "1464048060000":[0],
        "1464048120000":[0],
        "1464048180000":[0],
.
.
        "1464054960000":[0.01],
        "1464055020000":[0.01],
        "1464055080000":[0.01],
.
.
and for getDay I'm getting

Code: Select all

{
    "status":"ok",
    "data":
    {
        "1464021720000":[0.27,0.45],
        "1464022140000":[0.23,0.44],
.
.
.
        "1464048000000":[0.27,0.28],
        "1464048060000":[0.27,0.27],
        "1464048120000":[0.27,0.27],
Completely different! The results from getDay are what I would expect, but the result from getTimeSeries looks junk. I don't suppose you know what's going on do you? I've scoured other resources for ideas, not getting very far...

Thanks in advance,

bazza
Last edited by bazza on Tue May 24, 2016 11:38 am, edited 1 time in total.
bazza
Posts: 2
Joined: Tue May 24, 2016 10:51 am

Re: Efergy Engage Hub - Power Usage

Post by bazza »

Ha! Posted too soon.

Changing the aggregation function to avg instead of sum:

Code: Select all

http://www.energyhive.com/mobile_proxy/getTimeSeries?&fromTime=1464048000&toTime=1464106886&aggPeriod=minute&aggFunc=avg&offset=-60&token=xxxxx
Yielded:

Code: Select all

{
    "status":"ok",
    "data":
    {
        "1464048000000":[0.27],
        "1464048060000":[0.27],
        "1464048120000":[0.27],
        "1464048180000":[0.27],
.
.
        "1464054960000":[0.35],
        "1464055020000":[0.42],
        "1464055080000":[0.42],
Which is much more like it.

There's not much on the API page at http://napi.hbcontent.com/document/index.php to describe exactly what sum is supposed to be returning...
JJX
Cacti User
Posts: 402
Joined: Thu Oct 06, 2005 5:03 am

Re: Efergy Engage Hub - Power Usage

Post by JJX »

A small addition that could help:

Code: Select all

#!/bin/bash
energy=`curl 'http://www.energyhive.com/mobile_proxy/getCurrentValuesSummary?token=XXXXXX'`
Returned value:
[{"cid":"PWER","data":[{"1111111111001":676}],"sid":"788111","units":"kWm","age":11},
{"cid":"PWER","data":[{"1111111111002":0}],"sid":"789112","units":"kWm","age":57326},
{"cid":"PWER_SUB","data":[{"1111111111003":310}],"sid":"789113","units":null,"age":15},
{"cid":"PWER_SUB","data":[{"1111111111004":103}],"sid":"789114","units":null,"age":44}]

1st value:
echo $energy |cut -f4 -d":"|cut -f1 -d"}"
2nd value:
echo $energy |cut -f10 -d":"|cut -f1 -d"}"
3rd value:
echo $energy |cut -f16 -d":"|cut -f1 -d"}"
4th value:
echo $energy |cut -f22 -d":"|cut -f1 -d"}"
etc...
cacti rulez!
jckruger
Posts: 7
Joined: Wed Jun 17, 2015 6:56 pm

Re: Efergy Engage Hub - Power Usage

Post by jckruger »

My template still works for Cacti v1.1.7 :D
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests