bachya / pytile

📡 A simple Python API for Tile® Bluetooth trackers
MIT License
189 stars 27 forks source link

Battery Level always 0.0 #529

Closed shkarlsson closed 1 month ago

shkarlsson commented 2 months ago

Describe the bug When polling my devices, the data seems correct except battery_level, which is always 0.0.

To Reproduce Steps to reproduce the behavior:

from aiohttp import ClientSession
from pytile import async_login

async with ClientSession() as session:
    api = await async_login(email, password, session)
    tiles = await api.async_get_tiles()

    for _, tile in tiles.items():
        data = tile.__dict__["_tile_data"]["result"]["last_tile_state"]

        print(f"Battery level: {data['battery_level']}")

Expected behavior I expect the printed battery values to vary. I have some tiles several years old and some just a month old. It is impossible that they are all at 0.

Additional context I found another battery value, but for those, the value is either 10 or 40 which doesn't really make sense given the various ages of my tiles. In the reproduction code above, replace the print statement with below to see those values:

print(
            tile.__dict__["_tile_data"]["result"]
            .get("metadata", {})
            .get("battery_state")
        )
github-actions[bot] commented 1 month ago

There hasn't been any activity on this issue recently, so it has been marked as stale. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment. This issue will be closed if no further activity occurs. Thanks!