pyatmo
pyatmo copied to clipboard
Working example implementation for this library
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
?
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 https://github.com/jabesq-org/pyatmo/blob/4296c98ca86aac700b471513134863351cac7582/tests/test_weather.py#L21 for more details
I hope this helps a bit.