Author Topic: Open protocol for accessing (my own) weather station  (Read 428 times)

0 Members and 1 Guest are viewing this topic.

Offline Aussie Susan

  • Senior Member
  • **
  • Posts: 52
Open protocol for accessing (my own) weather station
« on: October 08, 2018, 09:36:07 PM »
I have a weather station that is connected to a RPi-zero that runs weewx and also nginx to provide a web display of the current and past weather.
I've also bought an Apple Watch (Series 3) and I have some experience in writing software for iOS (a couple of apps in the Apple App Store).
I want to gain some experience in writing a 'complication' for the watch and also find a better way to display the data from my weather station.
One problem with the current arrangement is that the up-load speed from my RPi is quite low so it takes a while for the web pages and images to be displayed. (I've also got Meteotemplate running but it is virtually useless for this reason - time outs occur before pages are ready etc.)
My idea is to write something for my iPhone that is linked to a complication on my watch that will show my weather station data.
Because of the upload speed issue, I want to send the raw data only and format it on the phone/watch.
Question: is there a (preferably open) standard protocol for the transmission of such data?
I can always invent something for myself but that means I can only ever link to my own weather station from my own phone. If there was an open standard then perhaps I could write an app that wold be more generally useful for others as well.
Susan (who is casting around for ideas)

Offline galfert

  • Forecaster
  • *****
  • Posts: 605
Re: Open protocol for accessing (my own) weather station
« Reply #1 on: October 08, 2018, 10:27:03 PM »
Since most people put their weather station on WU, I would use the WU API as a standard.

https://www.wunderground.com/weather/api/d/docs
WS-2902A | ObserverIP | WeatherBridge (Meteobridge)
WU: KFLWINTE111  |  PWSweather: KFLWINTE111
CWOP: FW3708  |  AWEKAS: 14814
Tele-Pole flag pole is here (not installed yet)

Offline Aussie Susan

  • Senior Member
  • **
  • Posts: 52
Re: Open protocol for accessing (my own) weather station
« Reply #2 on: October 08, 2018, 10:32:19 PM »
I am already on WU and WOW.
The problem with those is that they are web sites and it is harder for me to write an app that screen-scrapes the web site (or parses the HTML etc) and then formats the data for the watch complication than to access the data directly.
Also WU requires a fee-paid API key - it is my data so why should I pay then for access to the data I provide them for free.
Susan
« Last Edit: October 08, 2018, 10:45:25 PM by Aussie Susan »

Offline galfert

  • Forecaster
  • *****
  • Posts: 605
Re: Open protocol for accessing (my own) weather station
« Reply #3 on: October 08, 2018, 10:38:33 PM »
The API is for direct data. No screen scraping. You must ask for the JSON key. The key used to be free. But I think it still is free for limited use (low use).
WS-2902A | ObserverIP | WeatherBridge (Meteobridge)
WU: KFLWINTE111  |  PWSweather: KFLWINTE111
CWOP: FW3708  |  AWEKAS: 14814
Tele-Pole flag pole is here (not installed yet)

Offline R_o_B

  • WxElement panel
  • Member
  • *****
  • Posts: 41
    • Tzouhalem-Maple Bay Weather
Re: Open protocol for accessing (my own) weather station
« Reply #4 on: October 09, 2018, 10:13:42 AM »
Have you looked at the {json:api} 'A specification for building APIs in JSON' web site?

I had a look at the site a while back and I thought it had good ideas and documentation to simplify and standardize the creation of an API...
R_o_B
---
eMail: weather@tzweather.org

Offline TomKeffer

  • Member
  • *
  • Posts: 28
  • Author of weeWX
Re: Open protocol for accessing (my own) weather station
« Reply #5 on: October 10, 2018, 08:28:40 AM »
I think what "galfert" is suggesting is using the WU API as your protocol, not to literally connect to the WeatherUnderground. Unfortunately, it's a pretty crappy protocol: it uses an HTTP GET command to do what is really a POST, and offers no way of getting the data back out.

Recently, I had a similar problem and ended up designing my own weather API for the real-time version of WeeWX (called WeeRT). You can find details of the protocol in the WeeRT README.

If you decide to roll-your-own, I've found the essay RESTful Best Practices very useful for designing a proper API.

-tk
(author of WeeWX)

Offline galfert

  • Forecaster
  • *****
  • Posts: 605
Re: Open protocol for accessing (my own) weather station
« Reply #6 on: October 10, 2018, 12:16:47 PM »
I think what "galfert" is suggesting is using the WU API as your protocol, not to literally connect to the WeatherUnderground. Unfortunately, it's a pretty crappy protocol: it uses an HTTP GET command to do what is really a POST, and offers no way of getting the data back out.

Yes that is what I was saying, use the API as the protocol without needing to actually using Weather Underground. I was thinking also if the protocol was used it could also be used to pull data also from Weather Underground (with the requested JSON key). This way you could add flexibility to the application of where the data comes from.

I have though read that WU will soon be making some changes to their API. Surely if it has shortcomings then they should be corrected, but it still serves as a good starting point for a protocol to use.

Tom,
When you say the WU API protocol offers no way to get data out, I think you are referring to a bulk historical download. Because it is capable of getting data out that is Live Data.
WS-2902A | ObserverIP | WeatherBridge (Meteobridge)
WU: KFLWINTE111  |  PWSweather: KFLWINTE111
CWOP: FW3708  |  AWEKAS: 14814
Tele-Pole flag pole is here (not installed yet)

Online Bushman

  • Forecaster
  • *****
  • Posts: 7000
    • Eagle Bay Weather
Re: Open protocol for accessing (my own) weather station
« Reply #7 on: October 10, 2018, 12:36:46 PM »
Another option here (although the weert API looks great!)  https://openweathermap.org/api

Offline Aussie Susan

  • Senior Member
  • **
  • Posts: 52
Re: Open protocol for accessing (my own) weather station
« Reply #8 on: October 10, 2018, 10:09:17 PM »
Thanks everyone - and my apologies to Galfert for misunderstanding your suggestion.
Tom - I saw your posts elsewhere about WeeRT but I must admit I didn't put '2 and 2 together' - could be just what I'm after as I have weewx already running.
Susan

 

anything