Code Monkey home page Code Monkey logo

intelino-trainlib-py's People

Contributors

guoruicodes avatar petrusek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

intelino-trainlib-py's Issues

Train.set_next_split_steering_decision(SteeringDecision.STEER) throws exception

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).

python3 -m intelino.scan crashes python in MacOS. The library works fine, otherwise.

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

initelino.scan never finds train, macOS

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.

Bluetooth connectivity issue

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.