iMicknl / LoctekMotion_IoT

Learn how to connect your Flexispot (LoctekMotion) desk to the internet. This repository contains a collection of scripts to get your started, combined with research and instructions.
MIT License
626 stars 61 forks source link

How to emulate multiple simultaneous button presses? #79

Closed tgoulart closed 8 months ago

tgoulart commented 8 months ago

The keypad on my desk is dead, and I'm using the Raspberry Pi package in hope to move my desk down (currently stuck at a high position).

It almost works. The only command I can issue that has any noticeably effect is "down"; only a short click sound in the control box, but no actual movement. By tweaking the existing code, I was able to read "rSt" (like this) back from the desk, so I assume all it wants is for me to reset it. The manual says I should simply hold down, but the internet says it could be a more complex combination of keys.

Given that I don't have a physical keyboard to work with, I have a couple of basic questions:

  1. What's the correct way to emulate a long key press? I tried sending the command in a while True: loop, but doesn't seem to matter.
  2. Has anyone tried emulating two keys pressed simultaneously? I tried alternating the commands in a while True: loop, but also nothing noticeable.

Any insights would be valuable. And thanks for sharing putting all this information together.

tgoulart commented 8 months ago

I kept trying and finally got it working. I'm not sure what I was doing wrong, I just kept on iterating on the things I wasn't sure were correct. I have partial answers to my own question:

(1) Sending the command in a loop turned out to be the right thing to do. I interpret the "click" sound I mentioned above when sending just a single command to be the minimum amount the desk can move, which was visually imperceptible to me.

(2) I did not have to press multiple buttons simultaneously, holding "down" was enough, so I guess the question was irrelevant.

Again, thanks for the repository. I now have a usable desk again, and their terrible customer support won't affect my mood as much.