philippelt / netatmo-api-python

Netatmo connect API python client (for Netatmo information, see https://dev.netatmo.com)
GNU General Public License v3.0
186 stars 118 forks source link

No foreign station access (GetPublicData) #56

Closed Jscho7 closed 11 months ago

Jscho7 commented 11 months ago

weatherData = lnetatmo.WeatherStationData(auth) This line throws an error that there are no weather stations in any homes. What does it mean? I was using patatmo module (or library?), and retrieved data for a longer time period by creating a client, authorizing it with client credentials, and using Getpublicdata() to get a list of stations available. It was working well before the new authorization method last week. Thanks to @philippelt, I found their repo to do the authorization part. I want to get the information on all available stations in the API and the documentation says to use Getpublicdata(), but I don't know how to access this function in lnetatmo library. Can somebody please help me with this?

philippelt commented 11 months ago

According to Netatmo documentation, https://dev.netatmo.com/apidocumentation/oauth, to access homeData, that seems to me mandatory to enumerate homes and stations in homes you need one of read_camera or read_presence or read_smokedetector role in your token scope.

read_station is not mentioned so ensure you have at least one of this roles in your scope added to read_station.

Jscho7 commented 11 months ago

Are you referring the reference token generated based on the scope? I generated the token in the application homepage using read_station scope and authorized it. Now I don't own any netatmo sensors and I want to get access to the temperature measurements from other netatmo stations across the world. To do that I need to know the IDs of stations available within a region which can be possible by Getpublicdata() function. But I do not know if this exists in lnetatmo module. In patatmo I used these lines of code to get it.

client = patatmo.api.client.NetatmoClient() client.authentication.credentials = credentials region = { lat and long } output = client.Getpublicdata(region = region, filter=True)

philippelt commented 11 months ago

Unfortunately, I never implemented access to other stations in this library because I don't have a use case for it 🙃

philippelt commented 11 months ago

I just pushed a new version of the library with a direct raw access to netatmo API. Look at the sample at https://github.com/philippelt/netatmo-api-python/blob/v3.2.0/samples/rawAPIsample.py for an example...