This repository has been archived by the owner on May 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jiecang_desk_controller.yaml
104 lines (94 loc) · 2.62 KB
/
jiecang_desk_controller.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
esphome:
name: jiecang-desk-controller
friendly_name: Jiecang Desk Controller
includes:
- jiecang_desk_sensor.h
on_boot:
priority: 0 # when mostly everything else is done
then:
- uart.write: [0xF1, 0xF1, 0x0C, 0x00, 0x0C, 0x7e] # request physical limits
- delay: 0.1s
- uart.write: [0xF1, 0xF1, 0x20, 0x00, 0x20, 0x7e] # request limits
- delay: 0.1s
- uart.write: [0xF1, 0xF1, 0x07, 0x00, 0x07, 0x7e] # request settings
esp8266:
board: esp01_1m
# Enable logging
logger:
level: VERBOSE #makes uart stream available in esphome logstream
baud_rate: 0 #disable logging over uart
# Enable Home Assistant API
api:
encryption:
key: !secret encryption_key
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:
id: uart_bus
tx_pin: TX
rx_pin: RX
baud_rate: 9600
sensor:
- platform: custom
lambda: |-
auto desk = new JiecangDeskSensor(id(uart_bus));
App.register_component(desk);
return {desk->height,desk->height_pct,desk->height_min,desk->height_max,desk->position1,desk->position2,desk->position3,desk->position4};
sensors:
- id: "desk_height"
name: "Height"
unit_of_measurement: cm
accuracy_decimals: 1
- id: "desk_height_pct"
name: "Height Percent"
unit_of_measurement: "%"
- id: "desk_height_min"
name: "Height Min"
unit_of_measurement: cm
accuracy_decimals: 1
- id: "desk_height_max"
name: "Height Max"
unit_of_measurement: cm
accuracy_decimals: 1
- id: "desk_position1"
name: "Position 1"
unit_of_measurement: cm
accuracy_decimals: 1
- id: "desk_position2"
name: "Position 2"
unit_of_measurement: cm
accuracy_decimals: 1
- id: "desk_position3"
name: "Position 3"
unit_of_measurement: cm
accuracy_decimals: 1
- id: "desk_position4"
name: "Position 4"
unit_of_measurement: cm
accuracy_decimals: 1
button:
- platform: uart
name: "Raise"
data: [0xF1, 0xF1, 0x01, 0x00, 0x01, 0x7e]
- platform: uart
name: "Lower"
data: [0xF1, 0xF1, 0x02, 0x00, 0x02, 0x7e]
- platform: uart
name: "Position 1"
data: [0xF1, 0xF1, 0x05, 0x00, 0x05, 0x7e]
- platform: uart
name: "Position 2"
data: [0xF1, 0xF1, 0x06, 0x00, 0x06, 0x7e]
- platform: uart
name: "Position 3"
data: [0xF1, 0xF1, 0x27, 0x00, 0x27, 0x7e]
- platform: uart
name: "Position 4"
data: [0xF1, 0xF1, 0x28, 0x00, 0x28, 0x7e]