My goal also was to make it easy for beginners but we seem to have different approaches to reach that goal.
Too me that means no serial data or (kind of) complicated scripts in the yaml. Just three lines for the external component and a plain as possible configuration for buttons etc. The downfall is that it only supports one version of the protocol.
But I also see the benefit in you configuration. Especially the âno cpp coder neededâ argument is hard to beat when it comes to adapting to different versions of the protocol.
While were at it, my 2nd goal was to make it easy to combine the component with other features of esphome.
For example you could easily add some physical buttons to the spare pins of your controller and have them call the lambda-functions, you could create a secondary button interface like that. Or maybe a button that toggles between two desk heights.
Yeah I think I agree that your approach âis probably easierâ for a beginner. Especially now you have it as an external component, your config is very tight, and your docs are tidy;)
Probably part of me just wanted to tinker too;) And well I could support the yaml based one but not your cpp one if you arenât so active on it ( my cpp skills are limited).
Iâve linked your project in my OP now. Thanks for contributing to this thread;)
If you have the same desk as described in the blog article I mentioned⌠I canât promise it but Iâm very positive.
So as you already have the d1 mini all you need is an (old) landline phone cable and you could just give it a shot.
But just to be sure: no warranties! Donât mix up plus and minus
Yes, i will add some photos here and i also found the controll box on the site from jiecang I have an RJ45 cable but just for that you can confirm this i will also add a photo. @Rocka84 thank you also for your answer, here are the information you asked for
Additional i allready have the D1 mini and also two RJ45 female breakout connectors so that i can plug in the RJ45 cable from the button-thing and have then screws to connect wires then i dont have to cut the original cable
If your control box has both (like 1st two photoâs below), youâre probably better off using the RJ12 port for your smart control and building a dongle for that and then probably just use Rocka84âs project.
If you only have a RJ45 port, probably you should build a pass-through dongle.
From what I can see it looks good to go!
Next step I would flash a basic ESPHome config via usb and then make sure it powers on ok when plugged into the port.
I had some poor quality RJ12 cables which caused me power issues.
I now have made a new device in ESPHome and edited like this:
esphome:
name: ergotopia-david1
friendly_name: ergotopia-david1
on_boot:
# don't touch if you don't know what you're doing!
priority: 0 # when mostly everything else is done
then:
- lambda: "id(my_desk).request_physical_limits();"
- delay: 0.1s # give controller a chance to handle the response before sending the next command
- lambda: "id(my_desk).request_limits();"
- delay: 0.1s
- lambda: "id(my_desk).request_settings();"
external_components:
- source:
type: git
url: https://github.com/Rocka84/esphome_components/
components: [ jiecang_desk_controller ]
uart:
id: uart_bus
tx_pin: TX
rx_pin: RX
baud_rate: 9600
# Enable logging
logger:
baud_rate: 0 # disable logging over uart, required when using the RX/TX pins for the controller
# see full example for more options: https://github.com/Rocka84/esphome_components/blob/a083c17882361c58071b85d45587c410582cda75/example_jiecang_desk_controller.yaml
jiecang_desk_controller:
id: my_desk
buttons:
raise:
name: "Raise"
lower:
name: "Lower"
stop:
name: "Stop"
position1:
name: "Position 1"
position2:
name: "Position 2"
position3:
name: "Position 3"
position4:
name: "Position 4"
numbers:
height:
name: "Height"
# the usual stuff
esp8266:
board: esp01_1m
# Enable Home Assistant API
api:
encryption:
key: "KEY"
ota:
password: "PASSWORD"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Ergotopia-David1"
password: "PASSWORD"
captive_portal:
that should be right? then i just have to flash the device like described in the esp home tutorials by connecting it to my raspberry from home assistant and then it should be found as device, add API Key and should work?
Thank you for your help! The only thing is that the buttons âraiseâ and âlowerâ are just moving the desk minimum, not until there is a âstopâ.
But thats not a problem for me, i want to use the memory function and the height Thank you!
In your screenshot the height input is empty. Does it stay like that or does is show the correct height later on? And when you enter a value by hand, does the desk go to that height?
Yes, thatâs by design - at least for now. Maybe I should have called them âStep upâ and âStep downâ.
As for a continuous movement, I already had some code for that in one of the iterations - but removed it shortly after. The problem was that you canât stop that movement with the physical buttons on the controller. Imagine clicking down in home assistant, realizing that the desk would crush something and then not being able to stop the desk from its controller. Instead you have to search your phone and click âstopâ there. I didnât want to be responsible for that risk.
Weâll see what @Rocka84 reckons, but I suspect if we confirm if you are recieving any uart data on your rx by adding this to your config then that would be useful debugging info.
uart:
tx_pin: Xxxxx
rx_pin: Xxxxx
baud_rate: 9600
debug:
direction: BOTH
dummy_receiver: true
after:
delimiter: [0x7E]
# timeout: 5ms
sequence:
# Use mulcmu's method for reading uart without a custome component: https://community.home-assistant.io/t/how-to-uart-read-without-custom-component/491950?u=mahko_mahko
- lambda: |-
UARTDebug::log_int(direction, bytes, ','); // Log the message as int. Good for height message checks.
UARTDebug::log_hex(direction, bytes, ','); // Log the message in hex. Good for checking against protocol documentation.
Add the extra config, move the desk, and then post your logs.
So that idea was even better than I initially realized
In hindsight I should have thought of that much earlier. So thanks @Mahko_Mahko!
And I already implemented it as well:
Changes:
added buttons and lambdas for moving the desk up or down until stopped
move_up and move_down
renamed raise to step_up and lower to step_down
raise and lower are still supported but deprecated and undocumented