Tempest api data project

This is my first attempt to access some data for my new Tempest.

Had a look at
https://weatherflow.github.io/SmartWeather/api/
https://github.com/WeatherFlow (perhaps there will be something here eventually)

**Perhaps there is a better way to do this, please let me know **

I only appear to be able to get “type”: “obs_sky”, but I am looking for wpi;d be under type=“obs_st” or type=“obs_air”

https://weatherflow.github.io/SmartWeather/api/swagger/#!/observations/getObservationsByDeviceId
lists the results but I don’t appear to be able to change the results type

test API key limit?

I also tried the oauth option but I just get 404 not found.

https://swd.weatherflow.com/swd/rest/observations/device/25854?api_key=20c70eae-e62f-4d3b-b3a4-8586e90f3ac8

{

"status": {

    "status_code": 0,

    "status_message": "SUCCESS"

},

"device_id": 25854,

"type": "obs_sky",

"source": "cache",

"summary": {

    "precip_total_1h": 0.0,

    "precip_accum_local_yesterday": 0.012043,

    "precip_analysis_type_yesterday": 0

},

"obs": [

    [

        1597681675,

        31197,

        2.59,

        0,

        0,

        0.54,

        1.65,

        234,

        3.5,

        1,

        259,

        0,

        0,

        3,

        null,

        null,

        0

    ]

]

}

Project
I would like to pull the last 30 days of data and calculate an absolute humidity to add to a chart.
Personally I am finding the charts vis WF a bit lacking as RH without temperature feels incomplete.
Also gives me a change to play with the API and understand what’s possible

If I understand correctly, you are using the /swd/rest/observations/device endpoint to get the latest device observation from the WF API. The API call you shared was getting the observations from device 25854 which is a Sky device (hence the type is obs_sky). If you want to get observations from a Tempest device (obs_st), or an Air device (obs_air), you need to change the device ID to an appropriate Tempest/Air ID. The format of the URL is:

https://swd.weatherflow.com/swd/rest/observations/device/[DEVICE_ID]?api_key=20c70eae-e62f-4d3b-b3a4-8586e90f3ac8 (obviously replace [DEVICE_ID] with the ID you need).

1 Like

I got that station ID from my tempest weather device webpage

(this is where the docs suggested I get the number from)

I also see in the cards ST-00015285 at the top left of each card but have not tried that number.

Do devices have multiple IDs?

Ah I understand. There is a difference between a Station ID and a Device ID. Your Station ID is 25854, but your Tempest Device ID is 83635. You should be able to see this on the web by clicking on Settings -> Stations -> [station name] -> status.

The API endpoint you are using is for Device IDs not Station IDs. Just by chance though, it seems that there is a Sky device out there that shares its Device ID with your Station ID (25854). That is why you are seeing obs_sky from the API. If you change the device ID to 83635, you will see the observations from your Tempest:

https://swd.weatherflow.com/swd/rest/observations/device/83635?api_key=20c70eae-e62f-4d3b-b3a4-8586e90f3ac8

{"status":{"status_code":0,"status_message":"SUCCESS"},"device_id":83635,"type":"obs_st","source":"cache","summary":{"pressure_trend":"rising","strike_count_1h":0,"strike_count_3h":0,"precip_total_1h":0.0,"strike_last_dist":41,"strike_last_epoch":1597651647,"precip_accum_local_yesterday":0.127876,"precip_analysis_type_yesterday":0,"feels_like":25.2,"heat_index":25.2,"wind_chill":25.2},"obs":[[1597688593,0,1.28,2.5,126,3,997.3,25.3,55,111782,4.8,932,0,0,0,0,2.8,1,1.183336,null,null,0]]}

There is an API endpoint that works with Station IDs if you prefer though:

https://swd.weatherflow.com/swd/rest/observations/station/25854?api_key=20c70eae-e62f-4d3b-b3a4-8586e90f3ac8

Note how the URL above has changed from /observations/device/ to /observations/station/ Both will return the same data, but the fields returned in the station endpoint are much more verbose.

1 Like

Well thanks for that…

From
https://weatherflow.github.io/SmartWeather/api/#getting-started

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.

You are right I was using the Station ID of my station with the Device API. :man_facepalming:
Funny that about the ID match. If this worked my next question would have been why the data doesn’t appear to match for me.

https://swd.weatherflow.com/swd/rest/observations/device/83635?api_key=20c70eae-e62f-4d3b-b3a4-8586e90f3ac8&time_start=1595002376&time_end=1597680776

Becasue you helped so much already do you know how to adjust the “bucket_step_minutes”
This assumes I am correct when I think this means I am getting a datapoint every 180 minutes for the query?

right now it’s “bucket_step_minutes”: 180
for my project every 60 mins would be nice but it shouldn’t stop me.

thanks again

The bucket_step_minutes is limited based on the length of time between time_start and time_end. The longer that period, the longer the bucket_step_minutes has to be.

That being said I think there is an undocumented feature of the API that allows you to specify the bucket step length, as long as you don’t go over the maximum period. There are some details here: REST API: my wishlist to Santa Claus

Thanks, for that.
https://swd.weatherflow.com/swd/rest/observations/device/83635?time_start=1595302616&time_end=1597680776&bucket=c

I will take 30 minutes over 28 days

now that I have the base data comes the hard part, generating the new data and graphing the whole thing

1 Like