Whenever I attach to a Boost hub, I hit this assertion:
INFO:BLE Event Q.0:found device LEGO Move Hub
INFO:bleak.backends.winrt.client:Services resolved for BleakClientWinRT (00:16:53:A1:AC:1E)
INFO:BLE Event Q.0:Device advertised: {2: <bleak.backends.winrt.characteristic.BleakGATTCharacteristicWinRT object at 0x00000223E2352950>, 6: <bleak.backends.winrt.characteristic.BleakGATTCharacteristicWinRT object at 0x00000223E23527D0>, 8: <bleak.backends.winrt.characteristic.BleakGATTCharacteristicWinRT object at 0x00000223E2352C20>, 10: <bleak.backends.winrt.characteristic.BleakGATTCharacteristicWinRT object at 0x00000223E2352BF0>, 13: <bleak.backends.winrt.characteristic.BleakGATTCharacteristicWinRT object at 0x00000223E2352710>}
INFO:BLE Event Q.0:Connected to device LEGO Move Hub:00:16:53:A1:AC:1E
INFO:button.2:button.2 attached to Test.6, port 255
INFO:Test.6:Waiting for peripheral motor_ext to attach to a port
INFO:motor_r.4:motor_r.4 attached to Test.6, port 0
INFO:motor_l.3:motor_l.3 attached to Test.6, port 0
INFO:motor_ext.5:motor_ext.5 attached to Test.6, port 2
INFO:led.1:led.1 attached to Test.6, port 50
ERROR:asyncio:Exception in callback BLEventQ.get_messages.<locals>.bleak_received(13, bytearray(b'\...\x00\x00\x10')) at c:\src\bricknil\bricknil\ble_queue.py:76
handle: <Handle BLEventQ.get_messages.<locals>.bleak_received(13, bytearray(b'\...\x00\x00\x10')) at c:\src\bricknil\bricknil\ble_queue.py:76>
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "c:\src\bricknil\bricknil\ble_queue.py", line 78, in bleak_received
msg = msg_parser.parse(data)
File "c:\src\bricknil\bricknil\message_dispatch.py", line 52, in parse
Message.parsers[msg_type].parse(msg_bytes, l, self)
File "c:\src\bricknil\bricknil\messages.py", line 333, in parse
assert device_id in DEVICES, f'Unknown device with id {device_id} being attached (port {port}'
AssertionError: Unknown device with id 66 being attached (port 70 being attached
The program here is:
import asyncio
import logging
import bricknil
from bricknil.hub import BoostHub
from bricknil.sensor import InternalMotor, ExternalMotor, LED, Button
@bricknil.attach(LED, name='led')
@bricknil.attach(Button, name='button', capabilities=['sense_press'])
@bricknil.attach(InternalMotor, name='motor_l')
@bricknil.attach(InternalMotor, name='motor_r')
@bricknil.attach(ExternalMotor, name='motor_ext')
class TestHub(BoostHub):
pass
def main():
h = TestHub('Test')
bricknil.run(asyncio.sleep(1))
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO) # DEBUG
main()
Whenever I attach to a Boost hub, I hit this assertion:
The program here is: