Project to seamlessly integrate your Autonomous SmartDesk 2 with Home Assistant, while still retaining use of the controller keypad.
- Incrementally move desk up/down using buttons on Home Assistant
- Change desk height using a slider
- Read height of desk in inches
- Switch to one of four predefined height presets using a dropdown.
- Save the current desk height to one of the four memory presets, also with a dropdown.
This project was built with reference and inspiration from vipial1, developit, and Stefichen5. After failing to run the Espruino server on my esp32, I adapted the communication logic for ESPHome. This had the benefit of making the Home Assistant integration trivial. I also added support for new features, like setting memory presets and reading the desk height in inches.
- It's your responsibility to ensure the desk doesn't collide with anything as it moves, which can cause injury or damage. Only use this integration when you are physically present to intervene.
- Pressing UP/DOWN on the controller keypad should interrupt any command from this integration.
- Some low-voltage electronics work is needed. Use caution when using equipment like soldering irons and heat guns.
- After pressing the UP/DOWN buttons on the keypad controller, certain integration features (moving to a user-defined height, memory preset save) fail until at least 30 seconds elapse. My guess is that the keypad controller sends continuous instructions for that duration, which interferes with the programmed sequence sent from the wireless controller.
- Moving the desk to a user-defined height is functional but imperfect. E.g. suppose the desk is at height 80 (internal units, not inches), and you set the slider to 90 -- The desk will move up until the height is 90 +/- 3 and then slowly nudge up/down until it reaches 90 exactly. Compared to the smooth motion with presets, this is more janky.
-
ESP32 WROOM 3D development board
-
10P10C cable: I used the 1.5M version of the SinLoon RJ50 cable
-
Soldering kit, wires (24 AWG) and wire stripper
-
1N4148 diode: A 1N4148 diode is needed to continue using the keypad alongside the Home Assistant integration.
-
Heat-shrink tubes, electrical tape, hot glue: For electrical insulation and for securing cable to housing
-
Access to a 3D printer: To print and use the included housing STL as in the project
- Strip outer insulation of 10P10C cable.
- If using provided 3D printable case, avoid stripping more than 35mm of insulation to allow for a secure fit.
- Identify GND, RX, TX and 5V wires in the 10P10C cable. We will be tapping into these wires.
- Refer to table below to find which PINs relate to which function.
Pin | SinLoon RJ50 | SmartDesk 2 cable | Function |
---|---|---|---|
1 | Black | ||
2 | Brown | ||
3 | Red | ||
4 | Orange | Red | Sleep |
5 | Yellow | ||
6 | Green | ||
7 | Blue | Orange | GND |
8 | Purple | Yellow | RX |
9 | Gray | Green | TX |
10 | White | Blue | 5V |
- Check if your cable's pin color layout matches the layout for the SinLoon RJ50 cable. If so, simply use its layout to identify the relevant colors.
- Strip insulation off the 4 relevant inner wires and solder wires to them, making 3-way taps.
- (Highly recommended) Create breadboard prototype with cable attached to ESP32 to verify the whole system works. Jump ahead to ESPHome and Home Assistant sections for testing.
- Pin 16 (RX) of ESP32 is connected by green wire to tapped wire for RX.
- Pin 17 (TX) is connected by purple wire to the 1N4148 diode, with the darker end (cathode) pointed towards the ESP32 side. Other end of diode connects to TX wire.
- I labelled the wire ends with their respective functions because I only had red/black wires on hand :/ - Add shrink tubes before soldering the parts and wires to the top of the ESP32 board.
- (Optional) Print 3D casing using the included files and assemble.
- When assembling, use a ziptie on either end of the stripped section, before fitting it into the case with hot glue. This will help the cable from coming loose.
- Create a new device in ESPHome dashboard, and configure name, static ip address etc, as needed.
- Set the remote package and substitutions by adding the following snippet. Refer to example.yml for more info.
- Note: the min/max height is based on the extended model of the SmartDesk 2. If you have the regular model, the range is probably 75-123 based on this gist.
packages:
Autonomous_Desk: github://at-karan-sharma/autonomous-desk-esphome/config/desky.yml@main
substitutions:
uart_tx_pin: "17"
uart_rx_pin: "16"
desk_min_height: "66"
desk_max_height: "131"
- Install config to the ESP32 over wireless/serial connection.
- Look for the new ESPHome device in Home Assistant > Settings > "Devices & services" under the "Discovered" section.
- Click on "Configure" and add the encryption key (if configured in ESPHome) to finalize setup.
Feel free to contribute to this project by submitting issues or pull requests. Feedback and suggestions are also welcomed.