Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working example implementation for this library #489

Open
Lock128 opened this issue Feb 11, 2024 · 1 comment
Open

Working example implementation for this library #489

Lock128 opened this issue Feb 11, 2024 · 1 comment

Comments

@Lock128
Copy link

Lock128 commented Feb 11, 2024

Hey

do we somewhere have a "working" piece of code for this repository - so what are the 5 lines of code that we need to use the library?

e.g. how to I use async_update_weather_stations?

In my current code I had been using


authorization = pyatmo.NetatmoOAuth2(
    client_id=CLIENT_ID,
    client_secret=CLIENT_SECRET,
   # scope="read_station",
)

authorization.extra["refresh_token"]="xxx"
authorization.refresh_tokens()

# 2 : Get devices list
weatherData = pyatmo.WeatherStationData(authorization)

but somehow pyatmo.WeatherStationData does not show any stations anymore...

What's the adviced implementation way right now? Do I need to switch to async_update_weather_stations?

@cgtobi
Copy link
Collaborator

cgtobi commented Apr 8, 2024

Yes, you have to use async_account.async_update_weather_stations

Here is a rough sketch:

account = pyatmo.AsyncAccount(auth)
await account.async_update_topology()
await account.async_update_weather_stations()
async_account.homes[home_id].modules

Check

async def test_async_weather_update(async_account):
for more details

I hope this helps a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants