Efergy Engage API

No official api

I wanted to use the measurements of the efergy engage in my own home grown monitoring solution, but the efergy doen't support an official api. One solution I found on the web was to 'screen-scrape' the engage portal. Which is not an ideal solution, if they change their layout, you're back to square one.. So I did some digging and realized that the mobile apps need to get their data from somewhere.

So I did a little digging in the android app to see how it gets the data, and found they have a very nice (non public) api already built-in in the Engage web portal.

The api is a easy to use web api which returns JSON objects, it has quite a lot of functions, which I will describe in further posts, but here are the basics that you will need to get the latest value.

Authentication

The api uses a very basic authentication scheme which involves getting an access token from the api and sending id allong with every further request. Acquiring the access token is not more than a GET request with the following parameters :

  • Username
  • Password
  • DeviceType

Getting the access token :

https://engage.efergy.com/mobile_proxy/get_token?username=<username>&password=<password>&device=android

The result of the request is a JSON object with a status and the token :

{"status":"ok","token":"<token>"}

All other requests must include the value of the token as a url (GET) or form (POST) parameter.

The device is set to android, because that is what the mobile app uses. The device is used to identify active tokens on the Engage portal. A token can be used without authenticating again, as long as you don't revoke it in the portal.

insert screenshot of portal

Getting the measured last value

The value I am interested in most, is the realtime value. The api provides a couple of functions to get the last measured value which.

One of the functions to get the last measured value is the getInstant function. The web application uses another function with more information. I will describe these in another post.

Getting the last measured value :

https://engage.efergy.com/mobile_proxy/getInstant?token=<token>

This will return the last measured value in a JSON object :

{"age":15,"last_reading_time":1413724555000,"reading":283}
  • age : age of the returned measurement in seconds
  • last_reading_time : when the measurement was taken in number of millisecond since 1970/01/01
  • reading : the measured value in watts

See also :

comments powered by Disqus