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

Example code #2

Open
Pangel71 opened this issue Jan 18, 2021 · 1 comment
Open

Example code #2

Pangel71 opened this issue Jan 18, 2021 · 1 comment

Comments

@Pangel71
Copy link

Would it be possible to get a working example that just prints the information from the heater cloud?

Thanks.

Kind regards
Peter

@Sotolotl
Copy link
Owner

Sotolotl commented Jan 21, 2021

Something like this should get you started. I'll add a proper example script to the repository once I get the chance :)

import asyncio
import aiohttp
from meater import MeaterApi
from pprint import pprint

async def printDevices():
    session = aiohttp.ClientSession()

    api = MeaterApi(session)

    await api.authenticate('<your email address>','<your password>')

    devices = await api.get_all_devices()

    for device in devices:
        pprint(vars(device))
        if device.cook is not None:
            pprint(vars(device.cook))

loop = asyncio.get_event_loop()
loop.run_until_complete(printDevices())
loop.close()

Replace <your email address> and <your password> accordingly for now.

You do need to make sure you've got aiohttp installed, too.

Also worth noting; this code will throw an exception at the end because it's not closing resources properly, but it should be enough to help you get started :)

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