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

BleakError object is not subscriptable #21

Open
blackshoals opened this issue Jun 12, 2022 · 3 comments
Open

BleakError object is not subscriptable #21

blackshoals opened this issue Jun 12, 2022 · 3 comments

Comments

@blackshoals
Copy link

blackshoals commented Jun 12, 2022

'poetry install python cli.py' runs and finds Melnor devices. Connection fails with:

~/Downloads/melnor-bluetooth-main$ poetry run python cli.py 58:93:D8:37:29:59 Found device: Device( battery=0 valves=( Valve(id=0|is_watering=False|manual_minutes=20|seconds_left=0) Valve(id=1|is_watering=False|manual_minutes=20|seconds_left=0) Valve(id=2|is_watering=False|manual_minutes=20|seconds_left=0) Valve(id=3|is_watering=False|manual_minutes=20|seconds_left=0) ) ) Connecting to: 58:93:D8:37:29:59 Failed to connect to: 58:93:D8:37:29:59 Traceback (most recent call last): File "/home/ian/Downloads/melnor-bluetooth-main/cli.py", line 88, in <module> asyncio.run(main()) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() File "/home/ian/Downloads/melnor-bluetooth-main/cli.py", line 42, in main await device.fetch_state() File "/home/ian/Downloads/melnor-bluetooth-main/melnor_bluetooth/device.py", line 215, in fetch_state self._battery = parse_battery_value(some_bytes) File "/home/ian/Downloads/melnor-bluetooth-main/melnor_bluetooth/parser/battery.py", line 4, in parse_battery_value if (bytes[0] & 255 == 238) and (bytes[1] & 255 == 238): TypeError: 'BleakError' object is not subscriptable

@blackshoals
Copy link
Author

Commenting out lines 214,215 in device.py to bypass the call to the parser/battery.py allows the program to proceed.

@vanstinator
Copy link
Owner

Thanks for the report!

I'm not able to reproduce this on any of my devices. What device/make/model are you using?

@blackshoals
Copy link
Author

blackshoals commented Sep 2, 2022

Hi, I have 3 of the Melnor 65127-AMZ 2 zone Bluetooth Water timers to control 6 zones.

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