Wattvision API

API Version 0.2 is centered around sensors. You can store data with sensor ID, and you can download data given a sensor ID.

Download Data from Wattvision




sensor_idThe sensor ID to get data from. Found on API Settings Page.
api_idThe API ID. Found on API Settings Page.
api_keyThe API KEY. Found on API Settings Page.
typerate returns an list of timestamps and watts at that timestamp
consumption returns a list of timestamps and delta watthours
latest_rate returns the most recent rate in watts (as long as some data was uploaded within the last two hours)
net_consumption returns the total net consumption between any two points in time (only available on paid accounts)
start_timeISO UTC start time for data range
end_timeISO UTC end time for data range

Return Format

Returns a JSON object with two attributes:
  • "units" which is the units of the returned measurement.
  • "data" which is an array of JSON objects each with two attributes. "t" the time of the data point, and "v" the measurement

Send Data to Wattvision

HTTPS POST to URL: https://www.wattvision.com/api/v0.2/elec

The parameters are passed as part of the body of the POST request. We expect a JSON object with each of the following properties, some of which are optional. Note that JSON strings are enclosed by double quotes and numbers are not.


  • On the command line:
    curl -d '{"sensor_id":"XXXXXX","api_id":"XXXXXX","api_key":"XXXXXX","watts":1003}' http://www.wattvision.com/api/v0.2/elec

  • See some sample code here: Github API Sample Code


'sensor_id'(Required, JSON string) The sensor id with which the uploaded data will be associated. Must be authorized at the API Settings Page.
'api_id'(Required, JSON string) the api id that authorizes this data upload. Found on API Settings Page.
'api_key'(Required, JSON string) the api key that authorizes this data upload. Found on API Settings Page.
'time'(Optional, JSON string) the UTC ISO format date time (YYYY-MM-DDTHH:MM:SS) associated with the uploaded data, if not provided server time is used
You'll need to upload one or both of 'watts' or 'watthours'.
*for full tracking, you'll need to upload both, we don't auto-convert between types
'watts'(JSON number) a float value of a watts measurement
'watthours'(JSON number) a float value of the watthours consumed since the sensor started recording data (for a house that does not put energy back to the grid this number is a monotonically increasing function of time, but it doesn't have to be.)

Update Strategy

If you want to have your sensor showing as "sensor active" you must consistently upload faster than once every 5 minutes.

Response Codes

You will receive a 400 Bad Request if the request is not in the correct format.