forked from barrenechea/esphome-config-files
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uart-debugger.yaml
86 lines (77 loc) · 2.12 KB
/
uart-debugger.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
esphome:
name: "uart-debugger"
includes:
- components/desk/desk_keypad.h
esp32:
board: wemos_d1_mini32
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Sets up provisioning Wi-Fi credentials to the device over BLE
esp32_improv:
authorizer: none
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret api_encryption_key
ota:
# Logs hex strings by default
uart:
- id: keypad_uart
baud_rate: 9600
tx_pin: 17
rx_pin: 16
sensor:
- platform: custom
lambda: |-
auto desk_keypad_sensor = new DeskKeypad(id(keypad_uart));
App.register_component(desk_keypad_sensor);
return {desk_keypad_sensor};
sensors:
id: "desk_command"
name: Desk command
icon: "mdi:counter"
on_value:
then:
lambda: |-
ESP_LOGI("desk_command", "Received command: 0x%02X", (uint8_t)id(desk_command).state);
if(!id(keypad_switch).state)
{
ESP_LOGI("desk_command", "executing...");
if(id(desk_command).state == 1)
{
// id(desk).open();
} else if(id(desk_command).state == 2)
{
// id(desk).close();
} else if(id(desk_command).state == 3)
{
// id(switch_preset1).turn_on();
} else if(id(desk_command).state == 4)
{
// id(switch_preset2).turn_on();
} else if(id(desk_command).state == 5)
{
// id(switch_preset3).turn_on();
} else if(id(desk_command).state == 6)
{
// id(switch_m).turn_on();
} else if(id(desk_command).state == 7)
{
// id(switch_alarm).turn_on();
} else if(id(desk_command).state == 8)
{
// id(desk).stop();
}
}
switch:
- platform: template
name: "Keypad locked"
icon: mdi:key
id: "keypad_switch"
internal: false
restore_state: true
assumed_state: false
optimistic: true