fabiofenoglio / lelo-f1-python-sdk

LELO F1 SDK Python client
MIT License
13 stars 3 forks source link

Gui not running #1

Closed VoodooChild65 closed 4 years ago

VoodooChild65 commented 4 years ago

Hi,

I am a very noob to this have got python up and running installed pip etc.. and when I run the code get this error.. my programming is limited to VBA these days and been along time since I dealt with command line stuff... so I know I am the issue, but help would be appreciated,..

File "sample_gui.py", line 812, in app = GUISample(loop) TypeError: GUISample() takes no arguments

fabiofenoglio commented 4 years ago

Hello @VoodooChild65 , please could you tell me:

thank you for your cooperation

VoodooChild65 commented 4 years ago

the exact command you are running from command line python3 sample_gui.py

the version of the package you have installed, by running: pip show lelof1py Python client for LELO F1 SDK device Home-page: https://github.com/fabiofenoglio/lelo-f1-python-sdk Author: Fabio Fenoglio Author-email: development@fabiofenoglio.it License: MIT Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages Requires: bleak, asyncio, appdirs

the python version you are using, by running: python --version Python 2.7.16 or python3 --version Python 3.7.7

the pip version you are using, by running: pip --version pip 20.0.2 from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)

if you are running the project as downloaded or if you modified something No Modifications your script as was... just want to get it working first..

Big thanks for the help...

I could only find out how to instal Python using Homebrew and it made it python3 not over python

fabiofenoglio commented 4 years ago

Thank you, I tried the latest version of the sample with python 3.7.7 and it works for me. Can you please try with the latest version of sample_gui (committed today) ?

Could you also please attach a copy of the source file you are trying to run, so I can trace the exact version? Thank you

fabiofenoglio commented 4 years ago

Feels like an error related to PySimpleGUI. Which version of that package are you using? Please run pip show pysimplegui

That kind of error usually pops up when running with python3 some code written for python2.7, so maybe your pysimplegui version might not be up to date?

VoodooChild65 commented 4 years ago

Thanks again, and that makes sense to me.. here is the version

Version: 4.18.2 Summary: GUI SDK Launched in 2018. It's 2020 and PySimpleGUI is actively developed and supported. Super-simple to create custom GUI's. 200 Demo programs & Cookbook for rapid start. Extensive documentation. Examples using Machine Learning(GUI, OpenCV Integration, Chatterbot), Rainmeter Style Floating Desktop Widgets, Matplotlib + Pyplot integration, add GUI to command line scripts, PDF & Image Viewer. Great for beginners as well as advanced GUI programmers Home-page: https://github.com/PySimpleGUI/PySimpleGUI Author: PySimpleGUI Author-email: PySimpleGUI@PySimpleGUI.org License: UNKNOWN Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages Requires: Required-by:

fabiofenoglio commented 4 years ago

Your pysimplegui version is up to date. I inspected the source code of the failing version and found out that it doesn't formally support passing None as parameter for autoresizing, so I just committed an updated version setting fixed heights for buttons in the layout.

Please, try with the latest version of sample_gui.py and let me know

VoodooChild65 commented 4 years ago

Your a star!!! and on the way to making a distant couple very happy.. That work's in that he GUI Loads but doesn't detect the device it's on and the debug is saying device nearby but wrong name...

Any thoughts

2020-04-18 22:36:08,405 - lelo-f1-sdk-client - DEBUG - discovering nearby devices 2020-04-18 22:36:13,409 - lelo-f1-sdk-client - DEBUG - found 2 nearby devices 2020-04-18 22:36:13,409 - lelo-f1-sdk-client - DEBUG - of which 0 with correct name 2020-04-18 22:36:13,409 - lelo-f1-sdk-client - DEBUG - discovering nearby devices 2020-04-18 22:36:18,412 - lelo-f1-sdk-client - DEBUG - found 2 nearby devices 2020-04-18 22:36:18,412 - lelo-f1-sdk-client - DEBUG - of which 0 with correct name 2020-04-18 22:36:18,412 - lelo-f1-sdk-client - DEBUG - discovering nearby devices 2020-04-18 22:36:23,419 - lelo-f1-sdk-client - DEBUG - found 2 nearby devices 2020-04-18 22:36:23,419 - lelo-f1-sdk-client - DEBUG - of which 0 with correct name 2020-04-18 22:36:23,419 - lelo-f1-sdk-client - DEBUG - discovering nearby devices 2020-04-18 22:36:28,424 - lelo-f1-sdk-client - DEBUG - found 2 nearby devices 2020-04-18 22:36:28,424 - lelo-f1-sdk-client - DEBUG - of which 0 with correct name 2020-04-18 22:36:28,424 - lelo-f1-sdk-client - DEBUG - discovering nearby devices 2020-04-18 22:36:33,427 - lelo-f1-sdk-client - DEBUG - found 1 nearby devices 2020-04-18 22:36:33,427 - lelo-f1-sdk-client - DEBUG - of which 0 with correct name 2020-04-18 22:36:33,427 - lelo-f1-sdk-client - DEBUG - discovering nearby devices

fabiofenoglio commented 4 years ago

Thanks :)

Please, ensure that the device is in pairing mode. It should have the light on and be not vibrating. You could increase BLE logging by changing the line: logging.getLogger('bleak').setLevel(logging.INFO)

with: logging.getLogger('bleak').setLevel(logging.DEBUG)

note that, with distant couples in mind, I published two samples focusing on remote control: sample_sockey.py and sample_socket_controller.py. However I suggest that you stick with getting the sample_gui.py to work before moving on

VoodooChild65 commented 4 years ago

Goes in to what I believe is paring mode but doesn't;t stay on long before switching it's self off..

Will try changing that line..

Yes figured let's get this working before moving to the remote stuff, but where it's headed...

Back to you soon... does I matter the order as in power the discover ?

fabiofenoglio commented 4 years ago

The app enters discovery mode as soon as it starts and keeps searching for 60 seconds; maybe you could start the app, then as you see the GUI start the device. If the device switches off before the discovery is completed, you can turn the device on again and let the app keep searching.

Other things you could check:

VoodooChild65 commented 4 years ago

That helped in that it discovered something but then crashed and I get Python quit Unexpectedly... what of the error report would be useful ?

from the terminal window this is what I get

2020-04-18 22:56:37,045 - lelo-f1-sdk-client - INFO - succesfully connected to device 170053E4-913D-4D8D-88EF-F5DFB757E98D 2020-04-18 22:56:37,045 - lelo-f1-sdk-client - DEBUG - verifying communication layer 2020-04-18 22:56:37,045 - lelo-f1-sdk-client - DEBUG - sending ping to device 2020-04-18 22:56:37,045 - root - ERROR - error in task discover_and_connect: Characteristic 2A00 was not found! Traceback (most recent call last): File "sample_gui.py", line 673, in runner await task File "sample_gui.py", line 261, in discover await self.connect() File "sample_gui.py", line 279, in connect await self.get_client().connect(addr, timeout=30) File "/Users/nicholasklyne/pythonplay/lelof1py/async_client.py", line 126, in connect await self.ping() File "/Users/nicholasklyne/pythonplay/lelof1py/async_client.py", line 726, in ping await self.read(Registers.GENERIC_ACCESS_DEVICE_NAME, silent=True) File "/Users/nicholasklyne/pythonplay/lelof1py/async_client.py", line 248, in read read_direct = await self.bleak_client.read_gatt_char(register.address) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/bleak/backends/corebluetooth/client.py", line 169, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(_uuid)) bleak.exc.BleakError: Characteristic 2A00 was not found! 2020-04-18 22:56:37,048 - root - INFO - error in task: Characteristic 2A00 was not found! 2020-04-18 22:56:37,048 - root - DEBUG - runner task discover_and_connect finished Fatal Python error: PyEval_RestoreThread: NULL tstate

fabiofenoglio commented 4 years ago

I will look into this. Please, open another issue so I can tag that as a bug

VoodooChild65 commented 4 years ago

The app enters discovery mode as soon as it starts and keeps searching for 60 seconds; maybe you could start the app, then as you see the GUI start the device. If the device switches off before the discovery is completed, you can turn the device on again and let the app keep searching.

Other things you could check:

  • check that the F1s is not connecting to other devices such as your phone bluetooth
  • can you see the device on the 'available devices' in your phone's bluetooth settings? (do not connect to it); is its name 'F1s' ?

It's not showing up in my phone's bluetooth but if I open the app it connects.. Iphone 11