cloudy cloudy

Author Topic: Open Weather Map  (Read 3043 times)

0 Members and 1 Guest are viewing this topic.

Offline Ruben Perez

  • Posts: 58
  • OS/Browser:
  • Win NT 10.0
  • Chrome 64.0.3282.140
Re: Open Weather Map
« Reply #15 on: April 03, 2019, 09:01:17 AM »
I am trying to use, but I don't know how to setup. I don't find place to put API id key, and station id.

Thanks in advance.

Ruben
« Last Edit: April 09, 2019, 09:06:52 AM by Ruben Perez »

Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: Open Weather Map
« Reply #16 on: April 03, 2019, 09:04:26 AM »
you dont need an api key
as I have one . i.e that is used
the station ID is generated on the fly (live)
based on the lat/long and altitude of your station

that is all you need

that is how it works via the api
(and I know it is working as I am able to get the history data back for the data I have sent)
someone might correct me though

there is no place to view your data. i.e like you can with say wunderground
you are just hopefully providing data to help with the models and forecast data and generated current condition data for your lat/long

Offline Ruben Perez

  • Posts: 58
  • OS/Browser:
  • Win NT 10.0
  • Chrome 64.0.3282.140
Re: Open Weather Map
« Reply #17 on: April 03, 2019, 09:25:20 PM »
I am not sure if that is true...
I have an API key, that I use for example Xamarin Weather App for my students, but also I have generated an station and the API tells that you upload to the generated station ID.
At least, that is what I have read here:
https://openweathermap.org/stations

I think you could probably create one and use based on lat-lon, but I am not sure if every time I start Weather-Display, a diferent station is created. I am not sure also if you have any limit with your apikey. You could see all the stations that OWM have created using your api key.
http://api.openweathermap.org/data/3.0/stations

And also I think that you could retrieve your station information only if you know your id and station id. On the map, you can see it, I think that the stations also, but only current basic information. But maybe you can retrieve to use with your personal apps for example (Like OpenHAB).

I try now your setup, and tomorrow try to see if new station appears on map.

Ruben



Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: Open Weather Map
« Reply #18 on: April 04, 2019, 03:35:22 AM »
you might be right
I think the way I am doing it, there is a new station created each time
and instead I need to have it where you can set the station ID?
(but where/how do you get that?)

Offline Ruben Perez

  • Posts: 58
  • OS/Browser:
  • Win NT 10.0
  • Chrome 64.0.3282.140
Re: Open Weather Map
« Reply #19 on: April 04, 2019, 07:29:21 PM »
The problem is that OWM doesn't have a web UI to create the stations, so it must be created with a POST web petition. I have used some web services that allow do POST, GET, etc petitions with custom headers (I don't remember which one, but I can search, because not all works correctly). So doing this:
[POST] http://api.openweathermap.org/data/3.0/stations?appid=ab19XXXXXXX and adding this JSON header:
{
    "external_id": "SF_TEST001",
    "name": "San Francisco Test Station",
    "latitude": 37.76,
    "longitude": -122.43,
    "altitude": 150
}
with your custom data, external_id is like a code that you can asign, in my case I have used "OWMALCOIBARA1", name: "Alcoi - Baradello Gelat", lat, lon and altitude of my station.
If all works correctly, it returns this:
{
    "ID": "583436dd9643a9000196b8d6",
    "updated_at": "2016-11-22T12:15:25.96727176Z",
    "created_at": "2016-11-22T12:15:25.967271732Z",
    "user_id": "557066d0ff7a7e3897531d94",
    "external_id": "SF_TEST001",
    "name": "San Francisco Test Station",
    "latitude": 37.76,
    "longitude": -122.43,
    "altitude": 150,
    "source_type": 5
}
The ID could be used for future petitions to your station.
So you can send data to your station with this:
[POST] http://api.openweathermap.org/data/3.0/measurements?appid=ab19XXXXXXX
putting the data and station ID on the JSON header content:
[
  {
    "station_id": "583436dd9643a9000196b8d6",
    "dt": 1479817340,
    "temperature": 18.7,
    "wind_speed": 1.2,
    "wind_gust": 3.4,
    "pressure": 1021,
    "humidity": 87,
    "rain_1h": 2,
    "clouds": [
        {
            "condition": "NSC"
        }
    ]
  }
]

I only have created the station, and I am waiting Weather-Display could upload data to it  :lol: :lol: :lol:
All the API documentation is here:
https://openweathermap.org/stations

Ruben

Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: Open Weather Map
« Reply #20 on: April 04, 2019, 08:01:37 PM »
that is what I have done
but
what I am doing wrong
is am the doing the first part every time
and so a new station id is created and used each time
looks like I only need to do that once, store that station id, and use next time for data send
I will make that change now..
standby

Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: Open Weather Map
« Reply #21 on: April 04, 2019, 08:06:47 PM »
use this update
http://www.weather-display.com/downloadfiles/cronopenweathermap.zip
I guess I should though have that station id made visible,once its created,  e.g back in the setup ?

Offline Ruben Perez

  • Posts: 58
Re: Open Weather Map
« Reply #22 on: April 05, 2019, 07:55:31 PM »
I haven't tested yet the new version, when I could test it, I tell you here.
Maybe you can put a "Register Station" button, and then the station id is shown in a text label and remain saved on config.

Ruben

Enviat des del meu SM-T280 usant Tapatalk


Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Android 7.1.1
  • Chrome 73.0.3683.90
    • Weather Display
Re: Open Weather Map
« Reply #23 on: April 06, 2019, 04:58:23 AM »
the latest test update has it
Where the station ID is shown now
The next time you go back to the setup

Offline gabba

  • Posts: 168
  • Paris (at the) Hilton
  • Lower Hutt, New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Maungaraki, Lower Hutt, NZ -  Weather
Re: Open Weather Map
« Reply #24 on: April 06, 2019, 11:35:42 PM »
Hi

Following this with interest. Tried the latest build. When I click on "view your data" it goes off to the Wunderground site. Probably low on priorities, but thought I would mention it!

Cheers

Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: Open Weather Map
« Reply #25 on: April 07, 2019, 09:36:44 AM »
I will remove that link
as I do not actually know how to view on the web the data you send to open weather map?
does any one know?

Offline Ruben Perez

  • Posts: 58
  • OS/Browser:
  • Win NT 10.0
  • Chrome 64.0.3282.140
Re: Open Weather Map
« Reply #26 on: April 07, 2019, 04:56:36 PM »
I have updated to this one: http://www.weather-display.com/downloadfiles/weatherdisplaytest.zip but I don't appreciate any difference with the previous version. Also tried the openweathercron update. No station Id or "create station" or something like this, only same information as before (lat, lon, name, and altitude).

In the case to test data send, the api tells this one:
https://api.openweathermap.org/data/3.0/measurements?station_id=816aXXXXX&type=h&limit=100&appid=b1b1XXXXXX
With the type as the kind of agregated information of your station: "Type of the aggregated data - minute, hour or day. Specifies the letters m, h or d respectively"
"This method is used for receiving the aggregated measurements from the station. In total are supported 3 types of units - minute, hour and day"

It returns something like this:
[
    {
        "type": "m",
        "date": 1480508280,
        "station_id": "583d7bbbebb3ff000123f1ce",
        "temp": {
            "max": 22.7,
            "min": 21.7,
            "average": 22.03,
            "weight": 3
        },
        "humidity": {
            "average": 76.33,
            "weight": 3
        },
        "wind": {
            "deg": 160,
            "speed": 3.3
        },
        "pressure": {
            "min": 1031,
            "max": 1033,
            "average": 1031.67,
            "weight": 3
        },
        "precipitation": {}
    },
    {
        "type": "m",
        "date": 1480599660,
        "station_id": "583d7bbbebb3ff000123f1ce",
        "temp": {
            "max": 21.7,
            "min": 21.7,
            "average": 21.7,
            "weight": 1
        },
        "humidity": {
            "average": 77,
            "weight": 1
        },
        "wind": {},
        "pressure": {
            "min": 1031,
            "max": 1031,
            "average": 1031,
            "weight": 1
        },
        "precipitation": {}
    }
]

Offline Ruben Perez

  • Posts: 58
  • OS/Browser:
  • Win NT 10.0
  • Chrome 64.0.3282.140
Re: Open Weather Map
« Reply #27 on: April 07, 2019, 05:25:57 PM »
In the sample, lacks to params, the from and to timestamp in unix format:
I have tested this one (but my station hasn't currently any data):
https://api.openweathermap.org/data/3.0/measurements?station_id=5c927d0XXXXXXX&type=h&limit=100&from=1554076800&to=1554657771&appid=ab19d2f302dXXXXXXX

Ruben

Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: Open Weather Map
« Reply #28 on: April 07, 2019, 07:11:44 PM »
yes, I do know of that, that is how I know the data was being sent OK, as I was able to get it back OK
but that is not all that useful information, being just average data ?
anyway, try again that download, new update
http://www.weather-display.com/downloadfiles/weatherdisplaytest.zip

Offline Ruben Perez

  • Posts: 58
  • OS/Browser:
  • Win NT 10.0
  • Chrome 74.0.3729.48
Re: Open Weather Map
« Reply #29 on: April 09, 2019, 07:25:50 AM »
I am testing it... but not apreciable diference. I can't see stationid (and also I can't put apikey to avoid all people use yours).
And it is the last test version, because has MQTT option (this is the next thing I have to try with OpenHab).

Ruben

« Last Edit: April 09, 2019, 09:06:40 AM by Ruben Perez »