Adapted from Don Coleman’s Connected Devices source code.
The ITPower weather server collects longterm weather data from ITP’s weather station. This data is available to you - yes, you! - for whatever nefarious purposes you may desire.
The server collects the following data:
data point | type |
---|---|
wind_dir | int |
winddir_avg2m | int |
windspeedmph | float |
windgustdir_10m | int |
windgustmph_10m | float |
rainin | float |
dailyrainin | float |
rain_avg1m | float |
rain_avg10m | float |
temperature | float |
humidity | float |
pressure | float |
illuminance | float |
uva | float |
uvb | float |
uvindex | float |
First, we’ll have to add your device to the approved list of devices. Send your mac address to Brent, Yeseul, or contact someone in ITPower and we’ll get you access.
Basically, there are four endpoints most people will be concerned with:
https://{url}/itpower-data
: this gives you all the data since we started recording it. You can use the following cURL request to get it:
curl -X GET -d macAddress={yourMacAddress} -d sessionKey={yourSessionKey} https://{url}/itpower-data
https://{url}/itpower-data/:transactionID
Sample request:
curl -X GET -d macAddress={yourMacAddress} -d sessionKey={yourSessionKey} https://{url}/itpower-data/:{the ID number}
https://{url}/itpower-data/by-time
: this endpoint takes a from and to date. We’re using moment.js to parse dates, so it can take a lot of formats. If you want to get granular, you can check out the moment.js parsing documentation.
Sample request:
curl -X GET -d macAddress={yourMacAddress} -d sessionKey={yourSessionKey} -d dateFrom=’3-2-2020’ -d dateTo=’3-10-2020’ https://{url}/itpower-data/by-time
https://{url}/itpower-data/by-category
: this can take a single category (e.g. wind_dir
) or a comma-separated list of categories (e.g. wind_dir, rainin
). It will return all data points from that category.
Sample request:
curl -X GET -d macAddress={yourMacAddress} -d sessionKey={yourSessionKey} -d category=’winddir, rainin’ https://{url}/itpower-data/by-category
There’s no reason for you to post to this database! Talk to one of us if you’d like to get more involved in the weather station/database maintenance.
Please set up a local copy of this repository and test out any changes before you do so, but any pull requests/modifications/additional endpoints are welcome. You can follow Don’s original instructions for setup from the Connected Devices repo - some file names are changed, but the process is functionally identical.