getstationsdata python

The Netatmo API is a set of webservices allowing developers and third parties to access Netatmo device's data.
Post Reply
christian.foerster
Posts: 3
Joined: 15 May 2020, 15:49

getstationsdata python

Post by christian.foerster » 20 May 2020, 17:08

Hi there,

I'm trying to retrieve data from weather stations,.
First I get a list of all stations around Zürich:

Code: Select all


def _query(url, token="...."):
    response = requests.get(
        url, 
        headers={
            "accept": "application/json",
            "Authorization": f"Bearer {token}"
        }
    )
    #response.raise_for_status()
    return response
    
url = https://api.netatmo.com/api/getpublicdata?lat_ne=47.433023&lon_ne=8.629538&lat_sw=47.354699&lon_sw=8.472868&filter=false
data = _query(url)

Within the data body I find all the stations... For example

Code: Select all

{'_id': '70:ee:50:00:45:30',
 'place': {'location': [8.634436400000027, 47.42281870000001],
  'timezone': 'Europe/Zurich',
  'country': 'CH',
  'altitude': 454,
  'city': 'Wangen-Brüttisellen',
  'street': 'Chileweg'},
 'mark': 12,
 'measures': {'02:00:00:00:5a:9a': {'res': {'1589985581': [23.8, 40]},
   'type': ['temperature', 'humidity']},
  '70:ee:50:00:45:30': {'res': {'1589985609': [1022.4]}, 'type': ['pressure']},
  '05:00:00:00:37:fc': {'rain_60min': 0,
   'rain_24h': 0,
   'rain_live': 0,
   'rain_timeutc': 1589985600},
  '06:00:00:01:4b:54': {'wind_strength': 7,
   'wind_angle': 72,
   'gust_strength': 16,
   'gust_angle': 79,
   'wind_timeutc': 1589985607}},
 'modules': ['02:00:00:00:5a:9a', '06:00:00:01:4b:54', '05:00:00:00:37:fc'],
 'module_types': {'02:00:00:00:5a:9a': 'NAModule1',
  '06:00:00:01:4b:54': 'NAModule2',
  '05:00:00:00:37:fc': 'NAModule3'}}
I get the station id from the _id field.

To retrieve the station data I run:

Code: Select all

url = https://api.netatmo.com/api/getstationsdata?device_id=70%3Aee%3A50%3A00%3A45%3A30&get_favorites=false
data = _query(url)
Unfortunately I get an error response:

Code: Select all

{'error': {'code': 9, 'message': 'Device not found'}}
What am I doing wrong? And yes I use the read_station to create the token.

Thank you very much!!

Daegil_Netatmo
Posts: 12
Joined: 18 Jul 2019, 09:51

Re: getstationsdata python

Post by Daegil_Netatmo » 28 May 2020, 11:12

Hello!

As I would rather help you privately (RGPD), please contact us on our support: https://dev.netatmo.com/contact-us-form/
Select Support integrating Netatmo's products via API/Webhooks and fill the form.

Best regards,

humpty83
Posts: 5
Joined: 10 May 2017, 21:13

Re: getstationsdata python

Post by humpty83 » 15 Jun 2020, 15:41


Post Reply

Return to “Netatmo API”