jiecang_desk_controller: revisited example

This commit is contained in:
Rocka84
2024-01-09 18:32:56 +01:00
parent 113a6c3e11
commit b233989908
2 changed files with 52 additions and 34 deletions

View File

@@ -58,11 +58,19 @@ TX | RX
## Usage ## Usage
```yaml ```yaml
uart: esphome:
id: uart_bus ...
tx_pin: TX on_boot:
rx_pin: RX # This script is required to initialize the following sensors:
baud_rate: 9600 # 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
- lambda: "id(my_desk).request_limits();"
- delay: 0.1s
- lambda: "id(my_desk).request_settings();"
external_components: external_components:
- source: - source:
@@ -70,6 +78,15 @@ external_components:
url: https://github.com/Rocka84/esphome_components/ url: https://github.com/Rocka84/esphome_components/
components: [ jiecang_desk_controller ] 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: jiecang_desk_controller:
id: my_desk id: my_desk
sensors: sensors:

View File

@@ -2,37 +2,22 @@ esphome:
name: jiecang-desk-controller name: jiecang-desk-controller
friendly_name: Jiecang Desk Controller friendly_name: Jiecang Desk Controller
on_boot: 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 priority: 0 # when mostly everything else is done
then: then:
- lambda: "id(my_desk).request_physical_limits();" - lambda: "id(my_desk).request_physical_limits();"
- delay: 0.1s - delay: 0.1s # give controller a chance to handle the response before sending the next command
- lambda: "id(my_desk).request_limits();" - lambda: "id(my_desk).request_limits();"
- delay: 0.1s - delay: 0.1s
- lambda: "id(my_desk).request_settings();" - lambda: "id(my_desk).request_settings();"
esp8266: external_components:
board: esp01_1m - source:
type: git
logger: url: https://github.com/Rocka84/esphome_components/
level: WARN components: [ jiecang_desk_controller ]
baud_rate: 0 # disable logging over uart, required when using the RX/TX pins for the controller
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "esphome-desk"
password: "9ebc6eac0b4e0e26b8d3b955ec660557"
captive_portal:
uart: uart:
id: uart_bus id: uart_bus
@@ -40,11 +25,8 @@ uart:
rx_pin: RX rx_pin: RX
baud_rate: 9600 baud_rate: 9600
external_components: logger:
- source: baud_rate: 0 # disable logging over uart, required when using the RX/TX pins for the controller
type: git
url: https://github.com/Rocka84/esphome_components/
components: [ jiecang_desk_controller ]
jiecang_desk_controller: jiecang_desk_controller:
id: my_desk id: my_desk
@@ -106,3 +88,22 @@ jiecang_desk_controller:
# on_press: # on_press:
# lambda: "id(my_desk).goto_position(4);" # lambda: "id(my_desk).goto_position(4);"
# 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: