Overview
This API gives access to observations and meta data for WeatherFlow Smart Weather Stations. REST services are available for pulling data. The API also supports websocket connections for pushing data to listening clients.
- Websocket Data Streams
- Device Observations
- Device Events
- Station Observations (federated) (coming soon 2017)
- Station Events
You can learn more about WeatherFlow Smart Weather at http://www.weatherflow.com/smart-home-weather-stations/ . To see an example of what you can do with this API visit the Smart Weather website.
Getting Started
During development and for any use that is strictly personal (one user, yourself), use this development API key:
- 20c70eae-e62f-4d3b-b3a4-8586e90f3ac8
- Note, this key has some limitations in terms of frequency of requests and volume of data
- Please be aware that rights to data access my be revoked at any time for any reason. This may include, but not limited to, the number of stations accessible per key, frequency of requests, and volume of data.
When ready to deploy an applications/integration intended for use by others (more than one user, not yourself):
- Please contact us to obtain your own API key.
- Please include a description of the app or integration you're working on, and any other helpful information.
Demo Station and Devices
- station_id = 690
- (Air) device_id = 1110
REST
- Use the REST API Reference to see and test all services.
- Use the "Authorization" button to either enter your API Key or use the Oauth2 path to connect to your Smart Weather user account.
- If you do not do this step the API will respond with "401 Unauthorized"
- Find a station_id (this is the id of your Station). The easiest way to do this is sign into you Smart Weather account using a browser and go to an observation list view for a Station. You should see a URL that includes a station_id that looks something like this.
- Try the stations service using the station_id. The response should contain all of the meta data for the Station. Make note of a device_id so you can use it later to get observations.
- Try the observations service using just the device_id. If you only send the device_id in the request you should see the latest observation in the response.
- Use the "Authorization" button to either enter your API Key or use the Oauth2 path to connect to your Smart Weather user account.
- Examples (using the Demo Station and Device)
- GET Station Meta Data
- GET Latest Device Observation
- GET Latest Station Observation
Websocket
- Open a websocket connection
- wss://ws.weatherflow.com/swd/data?api_key=20c70eae-e62f-4d3b-b3a4-8586e90f3ac8
- Send a JSON message over the websocket connection to start listening for observations from the demo Device. After sending this message your connected websocket client sould receive a new observation JSON message every minute.
- { "type":"listen_start", "device_id":1110, "id":"random-id-12345" }
Object Model
Security
Smart Weather Station users have the option of setting the data for each of their stations as either public or private. The API has two access levels (Public and User).
- Public Access Level with API Key
- Access to all Stations currently set as "public"
- REST - Send your API Key as "api_key" in the query string with all API requests
- Websocket - Send your API Key as "api_key" in the query string when opening the websocket connection
- User Access Level with Oauth2 Access Token
- Access to all data owned by the user's access token
- Access to all Stations currently set as "public"
- Oauth2 Implicit Flow
- Use this flow to get an access token that never expires. This is the token you send with all API requests.
- REST - Send the Access Token as "token" in the query string with all API requests
- Websocket - Send the Access Token as "token" in the query string when opening the websocket connection
REST API Reference
Websocket API Reference
UDP Broadcast Reference
BLE Reference
coming soon