README update

This commit is contained in:
Rocka84
2024-06-04 23:24:06 +02:00
parent 7fc46c2670
commit e65d33f85e
4 changed files with 157 additions and 135 deletions

View File

@@ -28,7 +28,7 @@ pin | function
2 | GND
3 | TX
4 | VCC
5 | GND
5 | RX
6 | NC (pulled up)
#### RJ45
@@ -96,6 +96,9 @@ jiecang_desk_controller:
sensors:
height:
name: "Height"
numbers:
height:
name: "Height"
buttons:
raise:
name: "Raise"
@@ -106,12 +109,17 @@ button:
- platform: template
name: "Lower"
on_press:
lambda: "id(my_desk).lower();"
lambda: "id(my_desk).goto_height(84.0);"
```
See also [example_jiecang_desk_controller.yaml](../../example_jiecang_desk_controller.yaml).
### Examples
### Available sensors
* basic, sufficient for most people: [example_basic.yaml](example_basic.yaml)
* full with all features in use: [example_full.yaml](example_full.yaml)
### Features
#### sensors
sensor | description
-----------|----------------------------
@@ -124,7 +132,7 @@ position2 | 2nd stored height
position3 | 3rd stored height
position4 | 4th stored height
### Available number entities
#### number entities
Hold current values read from the desk and set values to desk when changed.
@@ -133,18 +141,29 @@ sensor | description
height | current height of the desk
### Available buttons and methods
#### buttons
button | lambda method | description
-----------|-----------------------------------|---------------------------
raise | `id(my_desk).raise()` | raise desk by one step (~14mm)
lower | `id(my_desk).raise()` | lower desk by one step (~14mm)
stop | `id(my_desk).stop()` | stop movement of desk
position1 | `id(my_desk).goto_position(1)` | move to 1st stored height
position2 | `id(my_desk).goto_position(2)` | move to 2nd stored height
position3 | `id(my_desk).goto_position(3)` | move to 3rd stored height
position4 | `id(my_desk).goto_position(4)` | move to 4th stored height
[n/a] | `id(my_desk).goto_height(height)` | move to specified height
button | description
--------------|---------------------------
raise | raise desk by one step (~14mm)
lower | lower desk by one step (~14mm)
stop | stop movement of desk
position1 | move to 1st stored height
position2 | move to 2nd stored height
position3 | move to 3rd stored height
position4 | move to 4th stored height
save_position | press position button afterwards to store current height to that position
#### lambda methods
lambda method | description
----------------------------------|---------------------------
`id(my_desk).raise()` | raise desk by one step (~14mm)
`id(my_desk).lower()` | lower desk by one step (~14mm)
`id(my_desk).stop()` | stop movement of desk
`id(my_desk).goto_position(pos)` | move to stored height `pos`
`id(my_desk).save_position(pos)` | save current height to position `pos`
`id(my_desk).goto_height(height)` | move to specified height
## Case
@@ -152,5 +171,5 @@ You can find a 3D-printable case in the [stl folder](stl/) or on [onshape](https
## Sources
Thanks to [phord/Jarvis](https://github.com/phord/Jarvis) for reverse engineering the UART interface and most control messages
Thanks to [phord/Jarvis](https://github.com/phord/Jarvis) for reverse engineering the UART interface and most control messages!
Thanks to [OkhammahkO](https://github.com/OkhammahkO) for collecting the scattered information at [pimp-my-desk/desk-control](https://gitlab.com/pimp-my-desk/desk-control) and for his work in the home assistant community!

View File

@@ -26,7 +26,7 @@ uart:
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/master/example_jiecang_desk_controller.yaml
# see full example for more options: https://github.com/Rocka84/esphome_components/blob/master/components/jiecang_desk_controller/example_full.yaml
jiecang_desk_controller:
id: my_desk
buttons:

View File

@@ -0,0 +1,118 @@
esphome:
name: jiecang-desk-controller
friendly_name: Jiecang Desk Controller
on_boot:
# This script is required to initialize the following sensors:
# height_pct, height_min, height_max, position1 - position4
# You can skip this if you don't use those.
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: local
path: rocka84_esphome_components/components/
# 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
logger:
baud_rate: 0 # disable logging over uart, required when using the RX/TX pins for the controller
jiecang_desk_controller:
id: my_desk
sensors:
height:
name: "Height"
height_min:
name: "Height Min"
height_max:
name: "Height Max"
height_pct:
name: "Height Percent"
position1:
name: "Position 1"
position2:
name: "Position 2"
position3:
name: "Position 3"
position4:
name: "Position 4"
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"
save_position:
name: "Save Position"
numbers:
height:
name: "Height"
## lambda usage
# button:
# - platform: template
# name: "Raise"
# on_press:
# lambda: "id(my_desk).raise();"
# - platform: template
# name: "Lower"
# on_press:
# lambda: "id(my_desk).lower();"
# - platform: template
# name: "Stop"
# on_press:
# lambda: "id(my_desk).stop();"
# - platform: template
# name: "Position 2"
# on_press:
# lambda: "id(my_desk).goto_position(2);"
# - platform: template
# name: "Save Position 4"
# on_press:
# lambda: "id(my_desk).save_position(4);"
# - platform: template
# name: "Go to 100cm"
# on_press:
# lambda: "id(my_desk).goto_height(100);"
# the usual stuff
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "esphome-desk"
password: "9ebc6eac0b4e0e26b8d3b955ec660557"
captive_portal:
api:
encryption:
key: !secret encryption_key
ota: