perara / python-systemair-saveconnect

API bindings for the systemair-savecair web interface
MIT License
15 stars 4 forks source link

Where to find device data #10

Open thomabsk opened 2 years ago

thomabsk commented 2 years ago

Hello! Trying to get this to work, and I realize there might have been some updates since the last example update on the readme?

Anyway I seem to have gotten it to work with a few small changes like the code below. It seems as though the read_data function might have actually returned the data before based on the documented code? Is the correct way to retrieve the data now through the devices registry class?

  # Authenticate
    if not await sc.login():
        raise RuntimeError("Could not connect to systemAIR")

    while(True):
        # Refresh Token
        await sc.auth.refresh_token()
        devices = await sc.get_devices()
        device_0 = devices[0]

        device_0_data_status = await sc.read_data(device=device_0)
        if(device_0_data_status):
            print("Updated device_0 data")
        else:
            print("Couldn't update device_0 data")

        print(device_0.registry.REG_USERMODE_MODE)

Also stuff like REG_USERMODE_MODE always seems to give out NONE, is this a limitation of the interface or should everything be availbable?

This is a really cool project, I am currently trying to implement this into another system, so I could help with documentation if needed.