anetczuk / LinakDeskApp

Desktop application that allows control of Linak office desk under Linux
MIT License
143 stars 13 forks source link

buttons do not work #2

Open phqzgunsfjror opened 4 years ago

phqzgunsfjror commented 4 years ago

Hi Anetczuk,

At first: great project and thanks for sharing it at GitHub!

I bought an Inwerk Masterlift 2. The Linak components are CBD6S 300W and I use a DPG1M (its the one without the lightstrip and without the display showing the hight).

My command opening your app: sudo python3 src/linakdeskapp/main.py

I am able to connect and it is showing all the information. If my desk goes up and down (by my DPG1M) all the values are updated immediately.

If I click on "up" nothing is happening even if I press it longer (the other buttons do not work either). The log output is:

2020-05-09 11:08:46,695 DEBUG    NotifHndlr-2 linak_dpg_bt.linak_device.LinakDesk:_handle_heigh_speed_notification [linak_device.py:714] Received height: 9960 3160 data: HeightSpeed[DeskPosition[3160] DeskSpeed[0]]
2020-05-09 11:09:01,213 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:moveUp [desk_mover.py:122] moving up
2020-05-09 11:09:01,216 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:157] stopping device
2020-05-09 11:09:01,252 DEBUG    MainThread linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.STOP_MOVING: 0xFF 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
2020-05-09 11:09:01,255 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:spawnThread [desk_mover.py:164] new thread spawned <CommandThread(DeskMover-7, started daemon 140648759031552)>
2020-05-09 11:09:01,314 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:155] stopping thread <CommandThread(DeskMover-7, started daemon 140648759031552)>
2020-05-09 11:09:01,756 DEBUG    DeskMover-7 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.MOVE_1_UP: 0x47 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
2020-05-09 11:09:01,757 DEBUG    DeskMover-7 linak_dpg_bt.desk_mover.CommandThread:_thread_loop [desk_mover.py:106] thread terminated
2020-05-09 11:09:01,757 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:157] stopping device
2020-05-09 11:09:02,258 DEBUG    MainThread linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.STOP_MOVING: 0xFF 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False

What could be the reason? How can I fix it?

Thank you in advance!

Kind regards, Lennard

anetczuk commented 4 years ago

Hello Lennard, nice to hear You like the app.

From the log it seems You jest clicked the Up button (pressed and released without waiting). Moving Up/Down works by holding buttons pressed until it is released. For testing purpose try one of:

  1. press Top (Status tab)
  2. press Bottom (Status tab)
  3. set Fav position and press "Move to" (Device tab) -- if favorites positions is supported in Your device We will see what logs say in those cases.
phqzgunsfjror commented 4 years ago

I hope it helps:

  1. top

    2020-05-21 14:12:47,475 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:moveToTop [desk_mover.py:134] moving top
    2020-05-21 14:12:47,476 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:157] stopping device
    2020-05-21 14:12:47,615 DEBUG    MainThread linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.STOP_MOVING: 0xFF 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
    2020-05-21 14:12:48,119 DEBUG    DeskMover-4 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending DirectionalCommand[30000]: 0x30 0x75 to Characteristic.CTRL1[99FA0031-338A-1024-8A49-009C0215F78A, 0x3a] w_resp=True
    2020-05-21 14:12:48,119 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:spawnThread [desk_mover.py:164] new thread spawned <CommandThread(DeskMover-4, started daemon 140580410222336)>
    2020-05-21 14:12:51,214 DEBUG    DeskMover-4 linak_dpg_bt.connection.BTLEConnection:_pull_notifications [connection.py:263] Receive notification timeout - trying to pull notification
    2020-05-21 14:12:54,788 DEBUG    DeskMover-4 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending DirectionalCommand[30000]: 0x30 0x75 to Characteristic.CTRL1[99FA0031-338A-1024-8A49-009C0215F78A, 0x3a] w_resp=True
    2020-05-21 14:12:57,844 DEBUG    DeskMover-4 linak_dpg_bt.connection.BTLEConnection:_pull_notifications [connection.py:263] Receive notification timeout - trying to pull notification
    2020-05-21 14:12:58,717 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:moveToTop [desk_mover.py:134] moving top
    2020-05-21 14:12:58,719 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:155] stopping thread <CommandThread(DeskMover-4, started daemon 140580410222336)>
    2020-05-21 14:13:01,416 DEBUG    DeskMover-4 linak_dpg_bt.desk_mover.CommandThread:_thread_loop [desk_mover.py:106] thread terminated
    2020-05-21 14:13:01,417 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:157] stopping device
    2020-05-21 14:13:01,417 DEBUG    MainThread linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.STOP_MOVING: 0xFF 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
    2020-05-21 14:13:01,417 DEBUG    DeskMover-5 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending DirectionalCommand[30000]: 0x30 0x75 to Characteristic.CTRL1[99FA0031-338A-1024-8A49-009C0215F78A, 0x3a] w_resp=True
    2020-05-21 14:13:01,417 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:spawnThread [desk_mover.py:164] new thread spawned <CommandThread(DeskMover-5, started daemon 140580410222336)>
    2020-05-21 14:13:04,472 DEBUG    DeskMover-5 linak_dpg_bt.connection.BTLEConnection:_pull_notifications [connection.py:263] Receive notification timeout - trying to pull notification
  2. bottom

    2020-05-21 14:16:01,669 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:moveToBottom [desk_mover.py:140] moving bottom
    2020-05-21 14:16:01,671 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:157] stopping device
    2020-05-21 14:16:01,849 DEBUG    MainThread linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.STOP_MOVING: 0xFF 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
    2020-05-21 14:16:02,353 DEBUG    DeskMover-7 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending DirectionalCommand[0]: 0x00 0x00 to Characteristic.CTRL1[99FA0031-338A-1024-8A49-009C0215F78A, 0x3a] w_resp=True
    2020-05-21 14:16:02,354 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:spawnThread [desk_mover.py:164] new thread spawned <CommandThread(DeskMover-7, started daemon 140580410222336)>
    2020-05-21 14:16:05,436 DEBUG    DeskMover-7 linak_dpg_bt.connection.BTLEConnection:_pull_notifications [connection.py:263] Receive notification timeout - trying to pull notification
    2020-05-21 14:16:09,7   DEBUG    DeskMover-7 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending DirectionalCommand[0]: 0x00 0x00 to Characteristic.CTRL1[99FA0031-338A-1024-8A49-009C0215F78A, 0x3a] w_resp=True
    2020-05-21 14:16:12,65  DEBUG    DeskMover-7 linak_dpg_bt.connection.BTLEConnection:_pull_notifications [connection.py:263] Receive notification timeout - trying to pull notification
    2020-05-21 14:16:16,140 DEBUG    DeskMover-7 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending DirectionalCommand[0]: 0x00 0x00 to Characteristic.CTRL1[99FA0031-338A-1024-8A49-009C0215F78A, 0x3a] w_resp=True
    2020-05-21 14:16:19,232 DEBUG    DeskMover-7 linak_dpg_bt.connection.BTLEConnection:_pull_notifications [connection.py:263] Receive notification timeout - trying to pull notification
  3. fav button (70cm)

    2020-05-21 14:16:36,213 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:moveToFav [desk_mover.py:146] moving to fav 0
    2020-05-21 14:16:36,214 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:155] stopping thread <CommandThread(DeskMover-7, started daemon 140580410222336)>
    2020-05-21 14:16:36,215 DEBUG    DeskMover-7 linak_dpg_bt.desk_mover.CommandThread:_thread_loop [desk_mover.py:106] thread terminated
    2020-05-21 14:16:36,215 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:157] stopping device
    2020-05-21 14:16:36,600 DEBUG    MainThread linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.STOP_MOVING: 0xFF 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
    2020-05-21 14:16:36,602 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:moveToFav [desk_mover.py:148] initializing new thread
    2020-05-21 14:16:36,604 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:spawnThread [desk_mover.py:164] new thread spawned <CommandThread(DeskMover-8, started daemon 140580410222336)>
    2020-05-21 14:16:37,104 DEBUG    DeskMover-8 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending DirectionalCommand[200]: 0xC8 0x00 to Characteristic.CTRL1[99FA0031-338A-1024-8A49-009C0215F78A, 0x3a] w_resp=True
    2020-05-21 14:16:40,195 DEBUG    DeskMover-8 linak_dpg_bt.connection.BTLEConnection:_pull_notifications [connection.py:263] Receive notification timeout - trying to pull notification
    2020-05-21 14:16:43,266 INFO     DeskMover-8 linak_dpg_bt.desk_mover.DeskMoverThread:_handle_moveToFav [desk_mover.py:190] device stopped
    2020-05-21 14:16:43,267 INFO     DeskMover-8 linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:155] stopping thread <CommandThread(DeskMover-8, started daemon 140580410222336)>
    2020-05-21 14:16:43,268 INFO     DeskMover-8 linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:157] stopping device
    2020-05-21 14:16:43,768 DEBUG    DeskMover-8 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.STOP_MOVING: 0xFF 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
    2020-05-21 14:16:44,270 WARNING  DeskMover-8 linak_dpg_bt.desk_mover.CommandThread:_thread_loop [desk_mover.py:103] handler thread termination
    2020-05-21 14:16:44,271 DEBUG    DeskMover-8 linak_dpg_bt.desk_mover.CommandThread:_thread_loop [desk_mover.py:106] thread terminated
anetczuk commented 4 years ago

It seems that application doesn't receive height notifications from device while sending move requests. Please investigate, if You receive following logs when moving desk with the controller:

2020-05-31 22:30:49,69 DEBUG NotifHndlr-1 linak_dpg_bt.linak_device.LinakDesk:_handle_heigh_speed_notification [linak_device.py:714] Received height: 10410 3427 data: HeightSpeed[DeskPosition[3427] DeskSpeed[2688]] 2020-05-31 22:30:49,167 DEBUG NotifHndlr-1 linak_dpg_bt.linak_device.LinakDesk:_handle_heigh_speed_notification [linak_device.py:714] Received height: 10406 3423 data: HeightSpeed[DeskPosition[3423] DeskSpeed[2448]] 2020-05-31 22:30:49,169 DEBUG NotifHndlr-1 linak_dpg_bt.linak_device.LinakDesk:_handle_heigh_speed_notification [linak_device.py:714] Received height: 10399 3416 data: HeightSpeed[DeskPosition[3416] DeskSpeed[2096]]

Then try to increase following timeout constants.DEFAULT_TIMEOUT.

In addition try one more thing: change method BTLEConnection.send_directional_command in connection.py to following: @synchronized @DisconnectOnException def send_directional_command(self, directionalCommand): return self._send_command_single(linak_service.Characteristic.CTRL1, directionalCommand, False)

The modification is to change last param from default to False value.

phqzgunsfjror commented 4 years ago

Sorry for answering so late.

This topic is getting more complicated.

DPG1M(1): I also tried it with the Android app from Linak. With my Samsung S8 I have absolutly no chance to connect. With my Samsung J3 I am able to connect, I see the position, the position gets updated when moving but I cannot control/move with the android app (so same behavior like your Linux app.)

Now back to your questions: It seems I get moving notifications if I use the deskpanel:

2020-06-14 08:26:06,381 DEBUG    NotifHndlr-2 linak_dpg_bt.linak_device.LinakDesk:_handle_heigh_speed_notification [linak_device.py:714] Received height: 9607 2807 data: HeightSpeed[DeskPosition[2807] DeskSpeed[1968]]
2020-06-14 08:26:06,430 DEBUG    NotifHndlr-2 linak_dpg_bt.linak_device.LinakDesk:_handle_heigh_speed_notification [linak_device.py:714] Received height: 9611 2811 data: HeightSpeed[DeskPosition[2811] DeskSpeed[1264]]
2020-06-14 08:26:06,479 DEBUG    NotifHndlr-2 linak_dpg_bt.linak_device.LinakDesk:_handle_heigh_speed_notification [linak_device.py:714] Received height: 9614 2814 data: HeightSpeed[DeskPosition[2814] DeskSpeed[528]]
2020-06-14 08:26:06,528 DEBUG    NotifHndlr-2 linak_dpg_bt.linak_device.LinakDesk:_handle_heigh_speed_notification [linak_device.py:714] Received height: 9614 2814 data: HeightSpeed[DeskPosition[2814] DeskSpeed[176]]
2020-06-14 08:26:06,576 DEBUG    NotifHndlr-2 linak_dpg_bt.linak_device.LinakDesk:_handle_heigh_speed_notification [linak_device.py:714] Received height: 9615 2815 data: HeightSpeed[DeskPosition[2815] DeskSpeed[0]]

Unfortunately I cannot find what I should change. Neither the timeout nor the method.

~/LinakDeskApp$ grep -rli "DEFAULT_TIMEOUT" .
-

~/LinakDeskApp$ find . connection.py
file or folder not found

~/LinakDeskApp$ grep -rli "BTLEConnection.send_directional_command" .
-

Where can I find it?

In the meantime I got another control panel. Let's call it DPG1M(2): I stil cannot connect with my S8 but with my J3. With the J3 I am able to see the high (also updating when moving) and I can move my desk with the android app. My hope was its the same like your Linux app. I can connect, I see the initial informations but it is not getting updates when I move. I can control the desk with your linux app but it stops for a moment every 2 cm because its not geeting updates about the high. The log is:

2020-06-14 09:16:27,367 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:moveUp [desk_mover.py:122] moving up
2020-06-14 09:16:27,367 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:157] stopping device
2020-06-14 09:16:27,488 DEBUG    MainThread linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.STOP_MOVING: 0xFF 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
2020-06-14 09:16:27,991 DEBUG    DeskMover-5 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.MOVE_1_UP: 0x47 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
2020-06-14 09:16:27,992 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:spawnThread [desk_mover.py:164] new thread spawned <CommandThread(DeskMover-5, started daemon 140479521879808)>
2020-06-14 09:16:28,495 DEBUG    DeskMover-5 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.MOVE_1_UP: 0x47 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
2020-06-14 09:16:29,499 DEBUG    DeskMover-5 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.MOVE_1_UP: 0x47 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
2020-06-14 09:16:30,513 DEBUG    DeskMover-5 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.MOVE_1_UP: 0x47 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
2020-06-14 09:16:31,63  INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:155] stopping thread <CommandThread(DeskMover-5, started daemon 140479521879808)>
2020-06-14 09:16:31,545 DEBUG    DeskMover-5 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.MOVE_1_UP: 0x47 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
2020-06-14 09:16:32,47  DEBUG    DeskMover-5 linak_dpg_bt.desk_mover.CommandThread:_thread_loop [desk_mover.py:106] thread terminated
2020-06-14 09:16:32,48  INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:157] stopping device
2020-06-14 09:16:32,48  DEBUG    MainThread linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.STOP_MOVING: 0xFF 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False

Any ideas? Thank you!

monofox commented 3 years ago

Have the same issue. E.g. button down:

2020-11-28 22:04:45,338 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:stopMoving [desk_mover.py:157] stopping device
2020-11-28 22:04:45,488 DEBUG    MainThread linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending ControlCommand.STOP_MOVING: 0xFF 0x00 to Characteristic.CONTROL[99FA0002-338A-1024-8A49-009C0215F78A, 0xe] w_resp=False
2020-11-28 22:04:45,490 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:moveToBottom [desk_mover.py:141] moving bottom
2020-11-28 22:04:45,491 INFO     MainThread linak_dpg_bt.desk_mover.DeskMoverThread:spawnThread [desk_mover.py:163] new thread spawned <CommandThread(DeskMover-6, initial daemon)>
2020-11-28 22:04:45,991 DEBUG    DeskMover-6 linak_dpg_bt.connection.BTLEConnection:_send_command_single [connection.py:225] Sending DirectionalCommand[0]: 0x00 0x00 to Characteristic.CTRL1[99FA0031-338A-1024-8A49-009C0215F78A, 0x3a] w_resp=True
2020-11-28 22:04:49,64  DEBUG    DeskMover-6 linak_dpg_bt.connection.BTLEConnection:_pull_notifications [connection.py:263] Receive notification timeout - trying to pull notification

I have a DPG1C. I faced the same with USB2LIN on Windows (with the old Linak App). On Windows with the original Desk Control App (the new for BLE), there are also no buttons available.

If i press one of the buttons, the graph and informations are not updated anymore automatically without restarting of the app.

@phqzgunsfjror + @anetczuk : do you have Anti-Collision system installed? I don't have it.

monofox commented 3 years ago

I've an update researching through Linak:

Hi, It sounds like you have a desk (limited version), which do not allow for remote control by an app. The features in the app depends on the desk system. You can try to contact your desk provider, to find a solution for you.

You can find full of such statements of Linak within the Android App comments. But its not clear to me, which component exactly is "limiting" it (cf. https://cdn.linak.com/-/media/files/user-manual-source/de/deskline-dpg-desk-panels-und-desk-control-app-montageanleitung-dt.pdf)

@phqzgunsfjror : If i check my model number in detail, its DPG1CS -- might it be for you too?

mckar commented 3 years ago

@monofox Do you also have an Inwerk Masterlift model which included the DPG1C? According to the data sheets the 6th position describes limited (=0) or full version (=3), S is not mentioned as option:

DPG1M00-000006 = limited DPG1M30-000006 = full https://cdn.linak.com/-/media/files/data-sheet-source/de/bedienelement-dpg1m-datenblatt-dt.ashx

DPG1C02-000006 = limited DPG1C32-000006 = full https://cdn.linak.com/-/media/files/data-sheet-source/de/bedienelement-dpg1c-datenblatt-dt.ashx

monofox commented 3 years ago

Hi @mckar , yes is a Inwerk Masterlift, but my desk is a bit older. At that point of time there were no DPG1C available, it was a DPF at that point of time.

So i got my DPG1C from a different source (who sold it a bit mixed of DPG1C and DPG1CS). And indeed its a DPG1C02 (= limited).

phqzgunsfjror commented 3 years ago

Hi, sorry, I missed the notifications. I have a

(yeah I got a second one from the manufacturer) The good thing is: it solved the problems with my smartphone app (was able to set favorites) but gps needs to be enabled while pairing (not only permission).

But I think Linak changes the bluetooth signals. This makes it incompatible with that github repo I guess.

I cannot understand why Linak keeps it proprietary.