rhyst / linak-controller

A Python script to control Linak standing desks.
MIT License
350 stars 51 forks source link

Error: module 'asyncio' has no attribute 'exceptions'. #41

Closed Nepomucene closed 2 years ago

Nepomucene commented 2 years ago

Fiddling with the controler. If I use the app to wake up the controller, I can now move the desk up and down, to any height asked. It handles limits (soft and hard) graciously, but now throws the following at the end: _ERROR:root:A message handler raised an exception: module 'asyncio' has no attribute 'exceptions'. Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/idasen_controller/main.py", line 246, in _move_to move_done.set_result(True) asyncio.basefutures.InvalidStateError: invalid state

rhyst commented 2 years ago

I think this came up in a different issue but the person stopped responding: https://github.com/rhyst/idasen-controller/issues/28

What version of python are you using?

Nepomucene commented 2 years ago

pi@Pi-Hole:~/.local/bin $ python --version Python 2.7.16 pi@Pi-Hole:~/.local/bin $ python3 --version Python 3.7.3

rhyst commented 2 years ago

Does replacing asyncio.exceptions.InvalidStateError with asyncio.InvalidStateError prevent that error?

Nepomucene commented 2 years ago

~Sorry, you're losing me here. No idea of how to do that...~ Edited the python file, error gone, but another one is here:

Height: 732mm Target: 730mm Speed: -29mm/s Height: 731mm Target: 730mm Speed: -21mm/s Height: 731mm Target: 730mm Speed: -13mm/s Task exception was never retrieved future: <Task finished coro=<stop() done, defined at /home/pi/.local/lib/python3.7/site-packages/idasen_controller/main.py:198> exception=BleakDBusError('org.bluez.Error.NotPermitted', 'Write acquired')> Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/idasen_controller/main.py", line 201, in stop await client.write_gatt_char(UUID_COMMAND, COMMAND_STOP) File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 815, in write_gatt_char assert_reply(reply) File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply raise BleakDBusError(reply.error_name, reply.body) bleak.exc.BleakDBusError: [org.bluez.Error.NotPermitted] Write acquired Task exception was never retrieved future: <Task finished coro=<stop() done, defined at /home/pi/.local/lib/python3.7/site-packages/idasen_controller/main.py:198> exception=BleakDBusError('org.bluez.Error.NotPermitted', 'Write acquired')> Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/idasen_controller/main.py", line 201, in stop await client.write_gatt_char(UUID_COMMAND, COMMAND_STOP) File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 815, in write_gatt_char assert_reply(reply) File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply raise BleakDBusError(reply.error_name, reply.body) bleak.exc.BleakDBusError: [org.bluez.Error.NotPermitted] Write acquired Task exception was never retrieved future: <Task finished coro=<unsubscribe() done, defined at /home/pi/.local/lib/python3.7/site-packages/idasen_controller/main.py:210> exception=BleakDBusError('org.bluez.Error.Failed', 'No notify session started')> Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/idasen_controller/main.py", line 212, in unsubscribe await client.stop_notify(uuid) File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 963, in stop_notify assert_reply(reply) File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply raise BleakDBusError(reply.error_name, reply.body) bleak.exc.BleakDBusError: [org.bluez.Error.Failed] No notify session started Final height: 730mm (Target: 730mm) Disconnected

Nepomucene commented 2 years ago

Used the latest main.py and can confirm that on my raspi4, both errors seem to have disappeared (ascencio and bleak). Desk still needs to be woken up by the app first to respond.

rhyst commented 2 years ago

Ah okay. I will close this and we can track the other issue here: https://github.com/rhyst/idasen-controller/issues/32

Would you be able to try the code I suggested in that issue? https://github.com/rhyst/idasen-controller/issues/32#issuecomment-1046068950

rhyst commented 2 years ago

Ah I see you did thanks!