Converting units of measure

I have the REST API going. My question is related to “the station_units values represent the units of the Station’s owner, not the units of the observation values in the API response as taken from the manual.

If I’m pulling (GET) the observation values I have to convert them on my end of the web app. Is there a way for the device to do the conversation or is that possible?

Did you see this: REST API - station units
I am not sure which ‘device’ you are meaning.

Yes thank you I did see station units. I have a TempestWX weather station. I’m a bit new at this so I’m thinking I’m not communicating this well.

The station API shows all the units as English based. inches of mercury, Fahrenheit etc … but the re turned values when request the API to bring current vales back from the device, they come back in metric.

I’m sure I’m missing something easy here. let me know plese.
Tom

If you want something other than SI units to display at your end, you need to do the conversion. That is the appropriate place to convert, not server side.

3 Likes

Hi Tom,
This is the way I think of the data flow and unit conversion. It may not be entirely accurate but it is the way I picture it in my mind.
The Tempest sends data to the hub.
The hub sends data to the Weatherflow servers.
When you view your Tempest display on your mobile or computer the Weatherflow servers are creating the display to send to your mobile or your computer in the units that you would like to read.
When you get data using the API you are getting the standard units which Weatherflow store the data in directly from the Weatherflow server.
I hope this helps
cheers Ian :slight_smile:

2 Likes

Ok thank you Ian, so follow me here on this. What you’re saying his if I’m integrating some of the data from the TempestWX station what’s technically happening ing:

  1. Data that I use from the Tempestwx API is originating from the Weatherflow Hub which stores the data in standard units.
  2. This means when I use the data in my web app I will need to do some unit conversion myself. Correct?
    I can’t get the data back into my web app as units that are converted to English for example.

Tom

That’s pretty much it.

All data requested from the Tempest API (REST, Websocket or UDP) will be delivered in standard metric SI units. You can see the units in the API documentation:

REST API: WeatherFlow Tempest API REST Reference - click ‘Expand Operations’ in the top right
Websocket: WeatherFlow Tempest API Websocket Reference
UDP: WeatherFlow Tempest UDP Reference - v171

Any conversions that you want to make for display (e.g. Celsius to Fahrenheit) have to be implemented by yourself in your web app. You cannot request converted data from the API.

2 Likes

That’s what I needed. Perfect thank you.