Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange situation: I have to unplug my desk for it to work, but after some time, it stops again. Need help. #114

Open
Metus88 opened this issue Feb 1, 2025 · 8 comments

Comments

@Metus88
Copy link

Metus88 commented Feb 1, 2025

My Hardware:

  • Flexispot E7Q
  • HS13M-1C0
  • CB38M4A(IB)-1
  • ESP32

My software settings:
office-desk-esp32.yaml

tx_pin: GPIO17 # TXD 2
rx_pin: GPIO16 # RXD 2
screen_pin: GPIO23

I used the PIN of famous #67

Just to be clear, the E7Q model has 4 motors (CB38M4A(IB)-1) with 2 RJ45 ports for keypads and comes with a premium keypad (HS13M-1C0).
I used one RJ45 port for the standard keypad and the other to connect my ESP32.

At the beginning, I thought everything was working great. Home Assistant could control the desk, and the physical keypad worked perfectly.

However, after some time (some hours), Home Assistant can no longer control the desk! (In the ESPHome logs, I can see that it sends commands, but in reality, nothing happens). The physical keypad still works. However, if I change the desk height using the keypad, the new height is correctly reflected in Home Assistant. So I believe ESPHome is still functioning, but the commands sent by the ESP32 are not affecting the desk.

If I unplug the desk from power (European 230V) and then reconnect it, both the physical keypad and the ESP32 work again, and they can fully control the desk.

Another important hint is that even when the ESP32 stops working, the physical keypad turns on when the ESP32 sends a command (so it detects the signal from the ESP32).

I'm very confused.

My thoughts:

  • The PINs are correct because it works (even if only for a short time).
  • The cables are fine (for the same reason).
  • The commands are correct (for the same reason).

So, I really don't know what to think.

Thanks for your help!

EDIT: unplug RJ45 esp32 and plug again only doesn't work.

UPDATE: If I press Wake screen on home assistant (when esp32 stop working) seems that it works again without unplug and plug again power to the desk. However how I say before is strange because the physical keypad turn on when I send commands from esp32 and they are not elaborate in reality. So I thought that the wake up screen was already hit. 😒😵‍💫😳

@JustAnotherPU
Copy link

Hi @Metus88 I have the exact same config and the exact same issue, I wasn't working for me until I read your post and decided to remove the plug and plug it again it is now taking command from my esp32 but after some time it does not respond :(

@Metus88
Copy link
Author

Metus88 commented Feb 12, 2025

@JustAnotherPU yes
The only workaround I've found is to "wake the screen on" in Home Assistant (with a short delay) before I send each command. This ensures the command is successfully sent to the desk. But it is not a perfect solution

@Hypfer
Copy link

Hypfer commented Feb 20, 2025

UPDATE: If I press Wake screen on home assistant (when esp32 stop working) seems that it works again without unplug and plug again power to the desk. However how I say before is strange because the physical keypad turn on when I send commands from esp32 and they are not elaborate in reality.

Here's my take as someone who has literally no idea and just bought an E7Q.

Is it perhaps possible that during normal operation, communication always starts with the keypad sending a wakeup command and only after that sends actual data?

Because if yes and that's not how the code currently works, it might be that perhaps previous controller units had some kind of fallback (maybe for older keypads that didn't do that?) which isn't present anymore in newer controllers/firmwares?

In any case, I'd suggest sniffing the uart of the keypad during normal operation and checking what is going on there.
Maybe the communication has changed a bit?

@SimonFischer04
Copy link

Hi @Metus88 I have the exact same config and the exact same issue, I wasn't working for me until I read your post and decided to remove the plug and plug it again it is now taking command from my esp32 but after some time it does not respond :(

Same issue here.
Kind of weird. Sometimes it works, sometimes not.

@iMicknl
Copy link
Owner

iMicknl commented Feb 20, 2025

  • Does executing the "Wake screen" command via the button fix the issue?
  • Do you have two RJ45 ports on your controller or just one? (and are you using pass-through, or did you remove the original control panel)
  • If not; how do you all power the ESP device? Do you power it via the desk directly, or via another power source?

My desk does have a touch control panel which I first touch, and afterwards I am able to touch again to execute my action. Via the ESPHome integration I can just control it directly and the "Wake screen" button is for my configuration not functional. It seems that for newer versions this might be required actually, and that we need to execute this function prior to all other executions. This would be a relatively easy fix in the ESPHome configuration.

ps. welcome @Hypfer 😉, I am a big fan of your Valetudo project, still runs like a charm on my old Roborock!

@Metus88
Copy link
Author

Metus88 commented Feb 21, 2025

  • Does executing the "Wake screen" command via the button fix the issue?

Yes it does! (I created automation in home assistant, First I send the command wake screen and later I send the command that I want and it works 100% of the time. )

script:
  scrivania_giu:
    alias: Scrivania giu
    sequence:
    - action: button.press
      target:
        entity_id: button.esp32n0_wake_screen
    - delay: 00:00:01
    - action: button.press
      target:
        entity_id: button.esp32n0_preset_1
  • Do you have two RJ45 ports on your controller or just one? (and are you using pass-through, or did you remove the original control panel)

I have 4 RJ45 ports for motors, 2 RJ45 ports for the keypad, and 2 strange ports with only 2 pins (each). One of these strange ports is used by the keypad. The keypad has 2 cables: one RJ45 and one strange cable with only 2 pins (maybe for power). I installed both the original keypad and the ESP32 at the same time.

  • If not; how do you all power the ESP device? Do you power it via the desk directly, or via another power source?

The Esp32 is powered directly from the RJ45 desk port.

My desk does have a touch control panel which I first touch, and afterwards I am able to touch again to execute my action. Via the ESPHome integration I can just control it directly and the "Wake screen" button is for my configuration not functional. It seems that for newer versions this might be required actually, and that we need to execute this function prior to all other executions. This would be a relatively easy fix in the ESPHome configuration.

Could you explain to me how to edit the ESPHome YAML to execute a wake screen command before every other command? I read somewhere in this repository that before sending a command, a pin has to be triggered for a specific amount of time (I don't remember exactly). However, I would also like to test whether increasing that time fixes the problem. Maybe my ESP32 does not trigger that pin for long enough? (What do you think? How I can increase it?)
Thanks a lot

@Metus88
Copy link
Author

Metus88 commented Feb 21, 2025

I'd suggest sniffing the uart

I don't have an oscilloscope, so I think I have to build something with an ESP32. Maybe you have some advice? (tutorials/links/guides) Is it possible to sniff the data without opening the keypad or without cutting the cable of the keypad?
I have 2 RJ45 ports dedicated to the keypad. They are connected in parallel, so I can plug my sniffer into the free RJ45 port and capture the commands traveling through the other port used by the keypad.
Sorry, but as you can tell from my questions, I'm a noob."

@Hypfer
Copy link

Hypfer commented Feb 21, 2025

Maybe you have some advice?

Essentially, you just want some way of accessing the wires over which the communication happens and something that is capable of listening in on that.

Personally I don't really like soldering together some bodges, so I've ordered 2 pairs of these in male and female on aliexpress to build some passthrough where I can easily attach something that speaks UART to the RX/TX lines as well.

Image

Just wire them together with some dupont cables and hope that signal integrity is still good enough (with UART at that baudrate it probably is)

As for the listening to what is happening:
Not sure what I'll use there. Probably some arduino nano or anything else 5v tolerant that can receive/decode UART on both lines. Or just a logic analyzer.
The correct way would probably be a logic analyzer

You could also just use a USB UART adapter and take turns. Or two of them with timestamped logs

If you decide to do the same, please make sure to measure everything thrice before plugging it into the desk.
You don't want to fry it by accidentially shorting or swapping connections

Btw: Aliexpress has those <Some kind of connector>-to-terminal-blocks things for all sorts of connectors. They're pretty useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants