Hi, I'm running into an issue with connecting to the frame via this library.
I am using linux, and frame_sdk-1.2.2. Here's the example script:
import asyncio
from frame_sdk import Frame
async def main():
async with Frame() as f:
print(f"Connected: {f.bluetooth.is_connected()}")
print(f"Frame battery: {await f.get_battery_level()}%")
print("disconnected")
asyncio.run(main())
Here's the error I get:
/home/ren/projects/personal/frame_test/.venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/client.py:632: UserWarning: Using default MTU value. Call _acquire_mtu() or set _mtu_size first to avoid this warning.
warnings.warn(
Traceback (most recent call last):
File "/home/ren/projects/personal/frame_test/main2.py", line 12, in <module>
asyncio.run(main())
File "/nix/store/l014xp1qxdl6gim3zc0jv3mpxhbp346s-python3-3.12.4/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/nix/store/l014xp1qxdl6gim3zc0jv3mpxhbp346s-python3-3.12.4/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/l014xp1qxdl6gim3zc0jv3mpxhbp346s-python3-3.12.4/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/ren/projects/personal/frame_test/main2.py", line 6, in main
async with Frame() as f:
File "/home/ren/projects/personal/frame_test/.venv/lib/python3.12/site-packages/frame_sdk/frame.py", line 32, in __aenter__
await self.ensure_connected()
File "/home/ren/projects/personal/frame_test/.venv/lib/python3.12/site-packages/frame_sdk/frame.py", line 46, in ensure_connected
await self.inject_all_library_functions()
File "/home/ren/projects/personal/frame_test/.venv/lib/python3.12/site-packages/frame_sdk/frame.py", line 224, in inject_all_library_functions
response = await self.bluetooth.send_lua(f"frame.file.mkdir(\"lib-{library_version}\");print(\"c\")", await_print=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ren/projects/personal/frame_test/.venv/lib/python3.12/site-packages/frame_sdk/bluetooth.py", line 345, in send_lua
await self._transmit(string.encode())
File "/home/ren/projects/personal/frame_test/.venv/lib/python3.12/site-packages/frame_sdk/bluetooth.py", line 320, in _transmit
raise Exception(f"Payload length is too large: {len(data)} > {self._btle_client.mtu_size - 3}")
Exception: Payload length is too large: 41 > 20
Interestingly, frameutils seems to work. I get the expected output from lua on frame when I run the following script:
import asyncio
from frameutils import Bluetooth
async def main():
bluetooth = Bluetooth()
await bluetooth.connect()
print(await bluetooth.send_lua("print('hello world')", await_print=True))
print(await bluetooth.send_lua('print(1 + 2)', await_print=True))
await bluetooth.disconnect()
asyncio.run(main())
I remember hearing awhile back that there's a bug with bluetooth driver on linux, I wonder if that is related to this? Any pointers would be appreciated, thanks.
Hi, I'm running into an issue with connecting to the frame via this library.
I am using linux, and
frame_sdk-1.2.2
. Here's the example script:Here's the error I get:
Interestingly,
frameutils
seems to work. I get the expected output from lua on frame when I run the following script:I remember hearing awhile back that there's a bug with bluetooth driver on linux, I wonder if that is related to this? Any pointers would be appreciated, thanks.