My findings getting this desk working with ESPHome
For anyone interested, my test code so far is here GitHub - shades66/Maidesite-standing-desk: My experimentations with connecting a Maidesite PRO 2 standing desk controller to HomeAssist
I was following another great thread on here around how to integrate with HA/ESPHome by tapping into the control & serial lines between the controller & handset but when I received my standing desk it looks like Maidesite changed the design so instead of a separate control box & handset everything is now contained within the handset itself. While I suspect a lot of what others have found would be do-able on this new handset it could easily void any warranties/guarantees pretty quickly I decided to see what could be done via the RJ12 socket which this machine does have. It has no mention Jiecang anywhere on the hardware/instructions I started playing with some information found off that thread and pretty quickly got the basics working. The hardest part was trying to get information to make the desk move to a specific position but eventually found someone had created a spreadsheet with a ton of useful information which suggests the controller is probably made by Jiecang or based on their design so is possibly usable by other brands that have an RJ12 connector.
So far working is
- Button to trigger any of the 4 presets
- Button to move UP/DOWN
- Slider to move direct to a height
- Get current settings for height & presets
Todo
- Tidy up code (remove test stuff)
- Make it retrieve the current height automatically (you need to press the test button at the start)
- Add buttons to create presets based on current height
- Look into automations to automatically lower after alarms/no-one at desk
hope it is of use to someone else with this desk.
Great work @Shades66.
I am planing to automate my Maidesite Desk, just waiting for the RJ12 cable to arrive.
By any chance could you add a photo / pic with the esp wiring. The devider for the TX connection is confusing me a bit.
Thanks a lot.
Edit: The cable arrived, but the colors are different. I think I have managed to work out the connections.
I have set up the eps32. Now when I trigger the TEST button, the desk control pannel lights up and the following is printed to the console. The rest of the sensors are unavailable.
It seem I’ve got some data send to the desk, but looks like nothing is getting from the desk to the ESP32.
[21:49:35][D][uart_debug:176]: >>> 241,241,7,0,7,126,241,241,8
[21:49:35][D][uart_debug:176]: >>> 0,8,126,241,241,9,0,9,126
[21:49:35][D][uart_debug:176]: >>> 241,241,12,0,12,126,241,241,14
[21:49:35][W][component:204]: Component api took a long time for an operation (0.05 s).
[21:49:35][W][component:205]: Components should block for at most 20-30ms.
[21:49:35][D][uart_debug:176]: >>> 0,14,12
Edit 2:
Got there at the end. Works well. Can’t wait to automate my daily standing routine
Thanks again for your work!!!
Hey, sorry I didn’t see anyone had responded to this, Glad to hear you got it working
I’ll add an image of the wiring to make it easier to identify the correct colours at some point over the weekend
anyone else wanting to know the circuit diagram I used the circuit from this page (just the resistors part into the ESP’s RX pin) Arduino Uno serial communication with ESP32 using voltage divider - #2 by groundFungus - Project Guidance - Arduino Forum
Nice work, i’ve got my cable and begin my work these days… thanks for your effort! Will tell you, if i was successful
Hi Mark,
I’m a bit lost as unfortunately not as technical as I once was… do you have a photo of your wiring etc please if possible linked to the ESP 32?
Do I flash desk.h onto the board and load dskcontrol.yaml into my configuration on Home Assistant?
Thanks
Richard
Hi guys!
I’m following the GitHub project to integrate my Maidesite desk as well.
Code on the ESP seems to be OK but I’m stuck at the very same first edit of @tomino
[21:18:05][D][button:010]: 'Desk test' Pressed.
[21:18:05][D][main:495]: TEST Pressed
[21:18:05][D][uart_debug:176]: >>> 241,241,7,0,7,126,241,241,8
[21:18:05][D][uart_debug:176]: >>> 0,8,126,241,241,9,0,9,126
[21:18:05][D][uart_debug:176]: >>> 241,241,12,0,12,126,241,241,14
[21:18:05][D][uart_debug:176]: >>> 0,14,126
No infos from the desk and as far as I can tell no other button are functioning. Any clues are welcome. What did I do wrong?
Hoping to read from you, as I revived this aging topic…
My bad!…
I was missing the home assistant’s entity to enable desk movement.
All’s up&running! Big up for the awesome work.
Hey, how did you manage to make it work in the end?
I got to the point where I can send the signals to the desk and make it move up/down, but I’m not getting any data from the desk back (current height, M1-4 heights). Do you happen to have a photo of your setup?
Hey, my problem was with the connections to uart. I had them mixed up.
Hi. I’m about to dive into your solution.
Has there been any progress on the remaining todo list?
I have a hard time to get it running.
I have a nodemcu esp-c3-32s-kit a151, the 5V from the RJ Connector is enough to power it. (Still tried the USB power to make sure)
But I had trouble finding the correct TX and RX pins for the esphome config. Turns out, I could not use the uart0 pins (U0RX U0TX). Instead I had to use others.
Receiving data now works, I get the memory profiles and the current height.
Sending data does not work, except the “Desk test” to trigger re-receiving the data.
But all commands dont do anything. Changed to different pins made no difference.
I also redid the whole connection, first I had a really long cable. Also I can beep it through with my multimeter. So I find it a bit strange that receiving works, but sending (that’s just a plain connection) does not.
Any ideas?
Added: my working wiring (maybe you need 5V and GND from USB - esp32-c3-devkitm-1 got enough power over RJ14, esp32dev (wroom rev1) did not)
From top to bottom:
purple GND
green TX
blue 5V
white RX
I have a RJ14, that works too(same connector, but only 4 pins in use)
My bad!…
I was missing the home assistant’s entity to enable desk movement.
I finally found out what was the problem. This. I didn’t understood what HobbitBen ment. It took me very long to figure it out myself.
Also the documentation is very unclear about this “feature”.
I also expected, that when I manually turn on that switch, it should stay on.
For anyone else that stumbles over this problem:
There is a home assistant entitiy binary_sensor.presence
that is imported into ESPhome, and it only works if that is “on”.
- So either update the ESPhome config to reflect that binary sensor name, if you have any presence detection. (under t
ext_sensor:
) - Or create a dummy
binary_sensor.presence
that is always on. - Or disable the check in the ESPhome config:
switch:
- platform: template
name: "Desk Enable"
...
return true;
} else {
return true; # <--- instead of false
}
...
Can someone maybe post a picture of the final set up.
I have a MAIDeSITe T2 Pro desk which I understand is the same as what @Shades66 has.
My understanding is that to get the control of the desk to HomeAssistant one needs a ESP board connected via RJ12 to the second (free) port to the motor controller (see picture at the bottom) and a usb power cable to provide power to the ESP.
Then deskcontrol.yaml
and desk.h
are used with ESPHome and that should be all.
Am I wrong?