intelino-code / intelino-trainlib-py Goto Github PK
View Code? Open in Web Editor NEWPython library (SDK) for interacting with the intelino smart train.
License: Other
Python library (SDK) for interacting with the intelino smart train.
License: Other
As it says, trying to set the next steering decision to just SteeringDecision.STEER will throw an exception. It works only when explicitly setting it to LEFT or RIGHT.
It would be great for this to work given that it can be a bit confusing.
Mac OS 11.6.1, python 3.9.9, intelino library cloned from sources (version 1.0.0).
The verification step, python3 -m intelino.scan
, crashes python. The good news is that the library works fine, otherwise.
This may be isolated to my hardware/software but it would be good to add a note to the documentation that it may happen. I have been stuck on it for about an hour before deciding to ignore it and, to my surprise, everything worked very well.
Please find the crash dump here, if it helps.
Thanks
Any guidance on what to troubleshoot if scan never finds the train? I've made sure it's not connected via Bluetooth, connected to another device, power cycled pc and train. Repeated all of this multiple times, repeated python env setup as well. Train works fine no-screen mode, with the phone app as well.
Attempting this on a m1 MacBook, macOS 12.1, python 3.10.0. Did all of the venv/pip steps, no issues. Terminal will request permissions, so it has it. Tried running from cmd line and PyEnv. I don't seem to be getting any environment issues, no weird exceptions... it just never finds anything.
I tried a test with just Bleak and wasn't able to connect at that layer, but I wasn't able to get it to connect. I was using the guid that shows up in BlueSee as the address to connect, but it wasn't
With Bleak logging on, output is below.
grant@Max ~/Dropbox/Code/PyStuff/Train/intelino-trainlib-py git:(master*)
λ python3 -m intelino.scan !663
2021-12-25 14:44:15,371 bleak.backends.corebluetooth.CentralManagerDelegate DEBUG: centralManagerDidUpdateState_
2021-12-25 14:44:15,371 bleak.backends.corebluetooth.CentralManagerDelegate DEBUG: Bluetooth powered on
2021-12-25 14:44:15,371 bleak.backends.corebluetooth.CentralManagerDelegate DEBUG: 'isScanning' changed
2021-12-25 14:44:18,375 bleak.backends.corebluetooth.CentralManagerDelegate DEBUG: 'isScanning' changed
Trains (0):
Others (0):
(.env)
Tried to see if any different behavior via TrainScanner directly...
test2.py:
from intelino.trainlib import TrainScanner
train_list = TrainScanner(timeout=5).get_trains()
print("\nlen={0}, contents={1}".format(len(train_list), train_list))
Same results, nothing found.
grant@Max ~/Dropbox/Code/PyStuff/Train/intelino-trainlib-py git:(master*)
λ python3 test2.py !667
2021-12-25 15:30:00,762 bleak.backends.corebluetooth.CentralManagerDelegate DEBUG: centralManagerDidUpdateState_
2021-12-25 15:30:00,763 bleak.backends.corebluetooth.CentralManagerDelegate DEBUG: Bluetooth powered on
2021-12-25 15:30:00,763 bleak.backends.corebluetooth.CentralManagerDelegate DEBUG: 'isScanning' changed
2021-12-25 15:30:05,767 bleak.backends.corebluetooth.CentralManagerDelegate DEBUG: 'isScanning' changed
len=0, contents=[]
(.env)
Ultimately, it seems like there's a basic issue finding the train at any level. It's working and connecting via other BLE utlls.
Hello,
I am reporting here a connectivity issue with the intelino J1 train. I am connecting to the train through the integrated Bluetooth connector of my pc (version 5.0). I am using python 3.8.8.
First of all, I switch on the train.
Then, when running python3 -m intelino.scan
, I can see the train.
Trains (1):
00:A0:50:A3:46:EC : intelino J-1 (RSSI -59)
But when I execute the first example python 01_get_train_info.py
, I get either this error:
Traceback (most recent call last):
File "01_get_train_info.py", line 25, in <module>
main()
File "01_get_train_info.py", line 14, in main
with TrainScanner() as train:
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelino/trainlib/train_scanner.py", line 50, in __enter__
self.blocking_train = self.get_train()
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelino/trainlib/train_scanner.py", line 82, in get_train
return Train(train)
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelino/trainlib/train.py", line 68, in __init__
self.__execute(self.__setup())
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelino/trainlib/train.py", line 104, in __execute
return asyncio.run_coroutine_threadsafe(
File "/home/niksart/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 439, in result
return self.__get_result()
File "/home/niksart/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
raise self._exception
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelino/trainlib/train.py", line 71, in __setup
await self.__train.connect()
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/intelino/trainlib_async/train.py", line 84, in connect
return await self._device.connect(force, **kwargs)
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/intelino/trainlib_async/train_ble_device.py", line 79, in connect
connected = await self._driver.connect(**kwargs)
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/intelino/trainlib_async/drivers/bleak_driver.py", line 49, in connect
await self.__bleak_client.start_notify(
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/bleak/__init__.py", line 834, in start_notify
await self._backend.start_notify(characteristic, wrapped_callback, **kwargs)
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/bleak/backends/bluezdbus/client.py", line 958, in start_notify
assert_reply(reply)
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Unlikely Error)
or this error:
Traceback (most recent call last):
File "01_get_train_info.py", line 25, in <module>
main()
File "01_get_train_info.py", line 14, in main
with TrainScanner() as train:
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelino/trainlib/train_scanner.py", line 50, in __enter__
self.blocking_train = self.get_train()
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelino/trainlib/train_scanner.py", line 82, in get_train
return Train(train)
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelino/trainlib/train.py", line 68, in __init__
self.__execute(self.__setup())
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelino/trainlib/train.py", line 104, in __execute
return asyncio.run_coroutine_threadsafe(
File "/home/niksart/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 439, in result
return self.__get_result()
File "/home/niksart/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
raise self._exception
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelino/trainlib/train.py", line 71, in __setup
await self.__train.connect()
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/intelino/trainlib_async/train.py", line 84, in connect
return await self._device.connect(force, **kwargs)
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/intelino/trainlib_async/train_ble_device.py", line 79, in connect
connected = await self._driver.connect(**kwargs)
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/intelino/trainlib_async/drivers/bleak_driver.py", line 41, in connect
connected = await self.__bleak_client.connect(**kwargs)
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/bleak/__init__.py", line 605, in connect
return await self._backend.connect(**kwargs)
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/bleak/backends/bluezdbus/client.py", line 268, in connect
await self.get_services(
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/bleak/backends/bluezdbus/client.py", line 656, in get_services
self.services = await manager.get_services(
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/bleak/backends/bluezdbus/manager.py", line 644, in get_services
await self._wait_for_services_discovery(device_path)
File "/home/niksart/kDrive/intelino/intelino-trainlib-py/intelinoenv/lib/python3.8/site-packages/bleak/backends/bluezdbus/manager.py", line 779, in _wait_for_services_discovery
raise BleakError("failed to discover services, device disconnected")
bleak.exc.BleakError: failed to discover services, device disconnected
I cannot predict the type of the error, it seems quite random to me.
I tried with the last version of the library, and with the release 1.0.0, and I have issues with both. I also tried with the async library and I have the same problem.
Please tell me if I can be of any help, or if any information is missing.
Thanks a lot for the help!
Edit:
This error in on OS Ubuntu 22.02 LTS, I did not encounter this problem on Windows 11
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.