-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
esp32.yaml
134 lines (108 loc) · 2.6 KB
/
esp32.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# BLE Keyboard project
# https://github.com/dmamontov/esphome-blekeyboard
############# User configuration #############
substitutions:
board: esp32doit-devkit-v1
mdns_name: blekeyboard
# Wifi credentials
wifi_ssid: "mywifissid"
wifi_password: "miwifipassword"
# OTA and API
ota_password: "esphome"
api_password: "esphome"
# Software configuration
input_text_entity_id: "input_text.blekeyboard_new_message" # A string object for entering arbitrary text.
########### End user configuration ###########
############# Base configuration #############
esphome:
name: $mdns_name
platform: ESP32
board: $board
comment: "https://github.com/dmamontov/esphome-blekeyboard"
# Enable logging
logger:
# Enable OTA
ota:
password: $ota_password
# Enable WiFi
wifi:
ssid: $wifi_ssid
password: $wifi_password
fast_connect: on
# Enable Home Assistant API
api:
password: $api_password
########### End base configuration ###########
# Enable components
external_components:
- source:
type: local
path: ../components
# - source: github://dmamontov/esphome-blekeyboard
ble_keyboard:
id: my_ble_keyboard
name: "MyBleKeyboard"
manufacturer_id: "Apple"
reconnect: true
battery_level: 50
buttons: true
text_sensor:
- platform: homeassistant
id: input_text
entity_id: $input_text_entity_id
internal: true
sensor:
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
button:
- platform: restart
entity_category: "config"
name: "Restart"
- platform: template
name: "Release"
id: key_release
icon: "mdi:send"
on_press:
then:
- ble_keyboard.print:
id: my_ble_keyboard
text: !lambda "return id(input_text).state;"
- ble_keyboard.release: my_ble_keyboard
- platform: template
name: "Ctrl + A"
id: key_ctrl_a
icon: "mdi:vector-combine"
on_press:
then:
- ble_keyboard.combination:
id: my_ble_keyboard
delay: 8
keys:
- 0x80
- "a"
- platform: template
name: "Calc"
id: key_calc
icon: "mdi:calculator"
on_press:
then:
- ble_keyboard.press:
id: my_ble_keyboard
code:
- 0
- 2
- platform: template
name: "Start advertising"
id: start_advertising
icon: "mdi:play"
on_press:
then:
- ble_keyboard.start: my_ble_keyboard
- platform: template
name: "Stop advertising"
id: stop_advertising
icon: "mdi:stop"
on_press:
then:
- ble_keyboard.stop: my_ble_keyboard