Desky Standing Desk (ESPHome) [Works with Desky, Uplift, Jiecang, Assmann & others]

Thanks for the advice and also whoops I lied lol, there is a model identifier on it, pics attached.

When I attempted to get the uart debugging setup I noticed this message in the logs:

[W][uart.arduino_esp32:206]:   You're using the same serial port for logging and the UART component. Please disable logging over the serial port by setting logger->baud_rate to 0

A little research led me here and following that guide I started testing with GPIOs 9 and 10 instead of 1 and 3 (because I had noticed you said you had to switch rx/tx on your D1 so I’ve made a point to try with both on this board).

That did bring with it a positive change, which is that the desk no longer randomly moves around when the rx or tx pins are connected. I can also use the buttons on the control panel with either of the pins connected, and sending up/down/stop commands all work fine.

Unfortunately getting the desk height and sending it to a specific one still don’t work, and I am not seeing any uart messages in the logs at all, and definitely not when I press the desk buttons.

Does your control box just have a rj45 port or does it have an rj12 too?

My control box does have both rj45 and rj12.

It would also help debugging if you post some pictures of your control box, wiring, and post your best config. Could be your wiring or you may need to switch rx/tx etc.

Attached pics of control box with model info, wiring pics, and pinout from seller for ESP32 board. Wiring all seems to be solid and as mentioned I’ve been trying switching rx/tx to no avail (both changing the pins specific in config, but also switching between the pins physically without changing the config). Let me know if anything stands out and thanks again for the help.

Simple config used to test for uart debugs (I’ve also tried your more complex config with the same pins/etc and the behavior is the same now that I’ve switched to trying GPIO’s 9 and 10 as rx_pin):

esphome:
  name: desk
  platform: ESP32
  board: node32s

logger:
  level: VERY_VERBOSE ##Uncomment to see UART debug messages 

external_components:
#Fetch ssieb's custom component# https://github.com/ssieb/custom_components/tree/master/components/desky
  - source:
      type: git
      url: https://github.com/ssieb/custom_components
    components: [ desky ]

uart:
  - id: desk_uart
    baud_rate: 9600
    rx_pin: GPIO9
    debug:
      direction: RX
      dummy_receiver: true
      after:
        bytes: 4
      sequence:     
        - lambda: UARTDebug::log_int(direction, bytes, ',');

desky:
  #uart_id: desk_uart  (optional, unless multiple uarts are defined)
  id: my_desky
  height:  # optional sensor publishing the current height
    name: Desk Height
    id: desk_height
    # any other sensor options
  up:    # optional <pin> config
    number: GPIO26
    inverted: true  # probably needed
  down:  # optional <pin> config
    number: GPIO25
    inverted: true  # probably needed
  request:  # optional <pin> config to request height updates at boot
    number: GPIO27
    inverted: true  # probably needed
  stopping_distance: 15  # optional distance from target to turn off moving, default 15
  timeout: 15s  # optional time limit for moving, default is none

binary_sensor:
  - platform: template
    name: Desky moving
    lambda: return id(my_desky).current_operation != desky::DESKY_OPERATION_IDLE;





We want to focus just on the wire that the desk sends messages on.

So try this.

Remove all config relating to the desky component (comment out). Similar to below. We want to focus on just using the uart debug to try to find uart messages.

I don’t think gpio09 is any good for this. See table with green/red etc. Although I’m not sure about that. Try say 21 in both config and wiring or one of the other ones that are all green in that rough number range.

Once you have done your initial flash with usb, you remove the usb cable and should try powering and grounding the esp via the desk. OTA connecting for looking at logs. Then try having just three wires connected to the esp. Gnd, power and the tx (which goes to your nominated rx on esp). See image.

Set that all up and see if you get some uart debug messages.


esphome:
  name: desk
  platform: ESP32
  board: node32s

logger:
  level: VERY_VERBOSE ##Uncomment to see UART debug messages 


uart:
  - id: desk_uart
    baud_rate: 9600
    rx_pin: GPIO21
    debug:
      direction: RX
      dummy_receiver: true
      after:
        bytes: 4
      sequence:     
        - lambda: UARTDebug::log_int(direction, bytes, ',');

Thanks a million, will run through this soon. I had left the power and ground cables disconnected from the ESP32 as the control box wasn’t powering them when I had them connected.

I played around with getting that to work at first without luck, then saw someone with the same issue say that powering from control box worked as long as they used USB power to boot the ESP32. Tried that and I started getting some smoke out of the ESP32 so immediately disconnected and have not tried powering it from the control box since lol. ESP32 seems to run fine despite that incident and the issues I’m having existed before that but who knows, could have fried something in the chip that will stop this from working.

1 Like

The other thing worth checking and confirming is that your pass through wiring is all correct.

It’s easy to make a mistake or for something to be amiss.

To do that check, follow this post.

Basically disconnect all wires from the esp and confirm the desk works as per normal with just the pass through wires in place.

Pass through wiring seems fine, desk controls all work fine when the control panel is run through the breakout and the ESP32 is fully disconnected.

Had some success using the config you suggested with GPIO21 set for uart, after rigging that up I see uart debug messages in the log. I’ve included those below, it doesn’t appear to be very consistent but then I don’t really know what I’m looking at.

Holding the down button:

[17:38:17][D][uart_debug:176]: <<< 255
[17:38:17][D][uart_debug:176]: <<< 255
[17:38:18][D][uart_debug:176]: <<< 255
[17:38:18][D][uart_debug:176]: <<< 255
[17:38:18][D][uart_debug:176]: <<< 255
[17:38:19][D][uart_debug:176]: <<< 255
[17:38:19][D][uart_debug:176]: <<< 255
[17:38:19][D][uart_debug:176]: <<< 255
[17:38:19][D][uart_debug:176]: <<< 255
[17:38:19][D][uart_debug:176]: <<< 255
[17:38:20][D][uart_debug:176]: <<< 255
[17:38:20][D][uart_debug:176]: <<< 255
[17:38:20][D][uart_debug:176]: <<< 255
[17:42:02][D][uart_debug:176]: <<< 255,255,255,255
[17:42:02][D][uart_debug:176]: <<< 127,255,255,255
[17:42:02][D][uart_debug:176]: <<< 255,255,255,255
[17:42:03][D][uart_debug:176]: <<< 255,255
[17:42:03][D][uart_debug:176]: <<< 253,255
[17:42:04][D][uart_debug:176]: <<< 255
[17:42:04][D][uart_debug:176]: <<< 253
[17:42:04][D][uart_debug:176]: <<< 109
[17:42:04][D][uart_debug:176]: <<< 255
[17:42:05][D][uart_debug:176]: <<< 255
[17:42:05][D][uart_debug:176]: <<< 255
[17:42:06][D][uart_debug:176]: <<< 255

Holding up button:

[17:39:10][D][uart_debug:176]: <<< 255
[17:39:11][D][uart_debug:176]: <<< 219,255,251,251
[17:39:11][D][uart_debug:176]: <<< 255,255,255,255
[17:39:11][D][uart_debug:176]: <<< 255,255,255,255
[17:39:11][D][uart_debug:176]: <<< 251
[17:39:11][D][uart_debug:176]: <<< 255,255,255,255
[17:39:11][D][uart_debug:176]: <<< 255
[17:39:12][D][uart_debug:176]: <<< 255,255,255,255
[17:39:12][D][uart_debug:176]: <<< 255,255,255,255
[17:39:12][D][uart_debug:176]: <<< 255,255,255,255
[17:39:12][D][uart_debug:176]: <<< 255,255,255,255
[17:39:12][D][uart_debug:176]: <<< 255,255,255,255
[17:39:12][D][uart_debug:176]: <<< 255,255,255,255
[17:39:12][D][uart_debug:176]: <<< 255,255,255,255
[17:39:12][D][uart_debug:176]: <<< 255,255,255,255
[17:39:12][D][uart_debug:176]: <<< 255,255,255,255
[17:39:12][D][uart_debug:176]: <<< 255,255,255,255
[17:39:12][D][uart_debug:176]: <<< 255,255,255,255
[17:39:13][D][uart_debug:176]: <<< 255,255,255,223
[17:39:13][D][uart_debug:176]: <<< 219,223,255,255
[17:39:13][D][uart_debug:176]: <<< 223,251,251,251
[17:39:13][D][uart_debug:176]: <<< 251,219,255,251
[17:39:13][D][uart_debug:176]: <<< 251,251,251,219
[17:39:13][D][uart_debug:176]: <<< 255,251,255,255
[17:39:13][D][uart_debug:176]: <<< 255,255,251,255
[17:39:13][D][uart_debug:176]: <<< 219,255,255,255
[17:39:13][D][uart_debug:176]: <<< 255,219,251,255
[17:39:13][D][uart_debug:176]: <<< 255,251,251,255
[17:39:13][D][uart_debug:176]: <<< 251,251,223,255
[17:39:13][D][uart_debug:176]: <<< 255,255,223,223
[17:39:14][D][uart_debug:176]: <<< 255,255,223,255
[17:39:14][D][uart_debug:176]: <<< 255,255,255,255
[17:39:14][D][uart_debug:176]: <<< 251,255,255,255
[17:39:14][D][uart_debug:176]: <<< 251,251,251,255
[17:39:14][D][uart_debug:176]: <<< 219,251,251,219
[17:39:14][D][uart_debug:176]: <<< 219,251,219,251
[17:39:14][D][uart_debug:176]: <<< 251,251,219,251
[17:39:14][D][uart_debug:176]: <<< 251,251,251,255
[17:39:14][D][uart_debug:176]: <<< 255,251,251,251
[17:39:14][D][uart_debug:176]: <<< 255,251,251,251
[17:39:14][D][uart_debug:176]: <<< 251,251,251,219
[17:39:14][D][uart_debug:176]: <<< 251,219,219,251
[17:39:14][D][uart_debug:176]: <<< 255,251,251,251
[17:39:14][D][uart_debug:176]: <<< 219,251,251,251
[17:39:15][D][uart_debug:176]: <<< 251,255,255,251
[17:39:15][D][uart_debug:176]: <<< 251,251,251,251
[17:39:15][D][uart_debug:176]: <<< 255,251,219,255
[17:39:15][D][uart_debug:176]: <<< 255,251,251,251
[17:39:15][D][uart_debug:176]: <<< 251,255

I then tried using GPIO21 for the rx_pin in your more complex config and found an interesting result:

  • if the up or down pins are connected the ESP32 stops sending logs to the console and stops responding to network traffic
  • if the request desk height pin is connected the ESP32 maintains network connectivity and the logs show a constant stream of the following:
[17:47:36][D][uart_debug:176]: <<< 0,192,0,224
[17:47:36][D][uart_debug:176]: <<< 224,254,224,192
[17:47:36][D][uart_debug:176]: <<< 224,192,224,224
[17:47:36][D][uart_debug:176]: <<< 192,224,224,224
[17:47:36][D][uart_debug:176]: <<< 62,254,248,248
[17:47:36][D][uart_debug:176]: <<< 248,224,192,192
[17:47:36][D][uart_debug:176]: <<< 192,192,254,248
[17:47:36][D][uart_debug:176]: <<< 192,240,240,192
[17:47:36][D][uart_debug:176]: <<< 192,192,240,254
[17:47:36][D][uart_debug:176]: <<< 254,248,240,240
[17:47:36][D][uart_debug:176]: <<< 192,248,192,240
[17:47:36][D][uart_debug:176]: <<< 240,192,240,254
[17:47:36][D][uart_debug:176]: <<< 248,248,192,240
[17:47:36][W][component:237]: Component uart took a long time for an operation (193 ms).
[17:47:36][W][component:238]: Components should block for at most 30 ms.
[17:47:36][D][uart_debug:176]: <<< 240,0,0,224
[17:47:36][D][uart_debug:176]: <<< 0,192,0,192
[17:47:36][D][uart_debug:176]: <<< 0,192,0,192
[17:47:36][D][uart_debug:176]: <<< 0,224,0,192
[17:47:36][D][uart_debug:176]: <<< 0,192,0,192
[17:47:36][D][uart_debug:176]: <<< 0,240,0,240
[17:47:36][D][uart_debug:176]: <<< 0,192,0,192
[17:47:36][D][uart_debug:176]: <<< 0,192,0,192
[17:47:36][D][uart_debug:176]: <<< 0,192,0,192
[17:47:36][D][uart_debug:176]: <<< 0,192,0,224
[17:47:37][D][uart_debug:176]: <<< 224,62,254,248
[17:47:37][D][uart_debug:176]: <<< 224,192,224,224
[17:47:37][W][component:237]: Component uart took a long time for an operation (177 ms).
[17:47:37][W][component:238]: Components should block for at most 30 ms.
[17:47:37][D][uart_debug:176]: <<< 224,192,192,224
[17:47:37][D][uart_debug:176]: <<< 254,248,224,248
[17:47:37][D][uart_debug:176]: <<< 224,248,192,224
[17:47:37][D][uart_debug:176]: <<< 224,192,0,192
[17:47:37][D][uart_debug:176]: <<< 0,224,0,192
[17:47:37][D][uart_debug:176]: <<< 0,224,0,192
[17:47:37][D][uart_debug:176]: <<< 0,224,0,192
[17:47:37][D][uart_debug:176]: <<< 0,192,0,224
[17:47:37][D][uart_debug:176]: <<< 0,192,0,240
[17:47:37][D][uart_debug:176]: <<< 0,192,254,254
[17:47:37][D][uart_debug:176]: <<< 248,224,192,224
[17:47:37][D][uart_debug:176]: <<< 192,192,224,192
[17:47:37][D][uart_debug:176]: <<< 192,192,0,224
[17:47:37][W][component:237]: Component uart took a long time for an operation (181 ms).
[17:47:37][W][component:238]: Components should block for at most 30 ms.
[17:47:37][D][uart_debug:176]: <<< 0,192,0,192
[17:47:37][D][uart_debug:176]: <<< 0,224,0,224
[17:47:37][D][uart_debug:176]: <<< 0,192,254,248
[17:47:37][D][uart_debug:176]: <<< 224,192,240,192
[17:47:37][D][uart_debug:176]: <<< 240,240,192,192
[17:47:37][D][uart_debug:176]: <<< 62,254,254,248
[17:47:37][D][uart_debug:176]: <<< 240,240,192,240
[17:47:37][D][uart_debug:176]: <<< 192,192,192,192
[17:47:37][D][uart_debug:176]: <<< 240,192,192,62
[17:47:37][D][uart_debug:176]: <<< 254,248,240,240
[17:47:37][D][uart_debug:176]: <<< 0,224,0,192
[17:47:37][D][uart_debug:176]: <<< 0,192,0,224
[17:47:37][W][component:237]: Component uart took a long time for an operation (169 ms).
[17:47:37][W][component:238]: Components should block for at most 30 ms.
[17:47:37][D][uart_debug:176]: <<< 0,192,0,240
[17:47:37][D][uart_debug:176]: <<< 0,192,0,192
[17:47:37][D][uart_debug:176]: <<< 0,192,0,224
[17:47:37][D][uart_debug:176]: <<< 0,224,0,192
[17:47:37][D][uart_debug:176]: <<< 248,224,224,224
[17:47:37][D][uart_debug:176]: <<< 224,192,224,192
[17:47:37][D][uart_debug:176]: <<< 224,224,254,248
[17:47:37][D][uart_debug:176]: <<< 248,248,224,192
[17:47:37][D][uart_debug:176]: <<< 224,224,192,192
[17:47:37][D][uart_debug:176]: <<< 192,192,192,0
[17:47:37][D][uart_debug:176]: <<< 224,0,192,0
[17:47:37][D][uart_debug:176]: <<< 192,0,192,0
[17:47:37][D][uart_debug:176]: <<< 224,0,192,0
[17:47:37][W][component:237]: Component uart took a long time for an operation (183 ms).
[17:47:37][W][component:238]: Components should block for at most 30 ms.
[17:47:37][D][uart_debug:176]: <<< 254,248,248,248
[17:47:37][D][uart_debug:176]: <<< 192,240,192,192
[17:47:37][D][uart_debug:176]: <<< 192,254,0,240
[17:47:37][D][uart_debug:176]: <<< 0,192,0,192
[17:47:37][D][uart_debug:176]: <<< 0,192,0,240
[17:47:37][D][uart_debug:176]: <<< 0,192,0,192
[17:47:37][D][uart_debug:176]: <<< 0,240,0,240
[17:47:37][D][uart_debug:176]: <<< 0,240,0,192
[17:47:37][D][uart_debug:176]: <<< 0,192,0,192
[17:47:37][D][uart_debug:176]: <<< 0,224,0,192
[17:47:37][D][uart_debug:176]: <<< 0,192,0,224
[17:47:37][D][uart_debug:176]: <<< 0,192,248,248
[17:47:37][W][component:237]: Component uart took a long time for an operation (169 ms).
[17:47:37][W][component:238]: Components should block for at most 30 ms.
[17:47:37][D][uart_debug:176]: <<< 224,248,192,224
[17:47:37][D][uart_debug:176]: <<< 224,224,192,192
[17:47:37][D][uart_debug:176]: <<< 0,192,0,192
[17:47:37][D][uart_debug:176]: <<< 0,224,0,224
[17:47:37][D][uart_debug:176]: <<< 0,192,0,192
[17:47:37][D][uart_debug:176]: <<< 0,192,0,240
[17:47:37][D][uart_debug:176]: <<< 192,62,254,254
[17:47:37][D][uart_debug:176]: <<< 224,192,224,192
[17:47:37][D][uart_debug:176]: <<< 224,192,192,0
[17:47:37][D][uart_debug:176]: <<< 192,0,192,0
[17:47:37][D][uart_debug:176]: <<< 0,240,0,240
[17:47:37][D][uart_debug:176]: <<< 240,62,254,240
[17:47:38][D][uart_debug:176]: <<< 248,240,240,192
[17:47:38][W][component:237]: Component uart took a long time for an operation (181 ms).
[17:47:38][W][component:238]: Components should block for at most 30 ms.
[17:47:38][D][uart_debug:176]: <<< 240,240,240,240
[17:47:38][D][uart_debug:176]: <<< 192,240,254,192
[17:47:38][D][uart_debug:176]: <<< 224,224,224,192
[17:47:38][D][uart_debug:176]: <<< 192,0,192,0
[17:47:38][D][uart_debug:176]: <<< 192,0,192,0
[17:47:38][D][uart_debug:176]: <<< 192,0,192,0
[17:47:38][D][uart_debug:176]: <<< 224,0,224,248
[17:47:38][D][uart_debug:176]: <<< 248,248,192,224
[17:47:38][D][uart_debug:176]: <<< 224,240,192,192
[17:47:38][D][uart_debug:176]: <<< 62,254,254,248
[17:47:38][D][uart_debug:176]: <<< 240,240,192,240
[17:47:38][D][uart_debug:176]: <<< 192,240,192,192
[17:47:38][W][component:237]: Component uart took a long time for an operation (175 ms).
[17:47:38][W][component:238]: Components should block for at most 30 ms.
[17:47:38][D][uart_debug:176]: <<< 240,254,248,254
[17:47:38][D][uart_debug:176]: <<< 248,240,248,192
[17:47:38][D][uart_debug:176]: <<< 240,240,192,0
[17:47:38][D][uart_debug:176]: <<< 192,62,254,248
[17:47:38][D][uart_debug:176]: <<< 224,192,224,192
[17:47:38][D][uart_debug:176]: <<< 224,192,192,192
[17:47:38][D][uart_debug:176]: <<< 62,248,248,224
[17:47:38][D][uart_debug:176]: <<< 248,224,230,192
[17:47:38][W][component:237]: Component uart took a long time for an operation (110 ms).
[17:47:38][W][component:238]: Components should block for at most 30 ms.

Ok I think that’s progress.

I think the messages can be noisy if you’re not grounded properly. Try adding the ground wire like this. Remove it if anything smokes etc;) I think it is ok.
I assume you are still powering via usb?

After looking at logs for that, also, try changing this to 9.

bytes: 9

Move the desk up or down and post logs again please.

If we do hit a dead end with the rj45 port, you can also try your luck with the rj12 port. It’s even potentially preferable.

Also, if you have a multimeter, it’s worth checking you get 5v on the power/gnd desk wires that go to the esp.

So i got this Uppspel IKEA desk and long story short: I’ve built my own little desky, but could not find a suitable enclosure for a USB-C D1 Mini. So i’ve remixed the one from Okham and made a few modifications.

The result is available at Desky Standing Desk DIY Wifi Dongle Enclosure for USB-C D1 mini by CtrlAltProcrastinate - Thingiverse and looks like this:

2 Likes

Nice! Thanks for sharing back!