-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathexample.yaml
More file actions
289 lines (261 loc) · 6.74 KB
/
Copy pathexample.yaml
File metadata and controls
289 lines (261 loc) · 6.74 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
esphome:
name: esphome-eqiva-lock
friendly_name: esphome-eqiva-lock
esp32:
variant: ESP32S3
board: seeed_xiao_esp32s3
flash_size: 8MB
framework:
type: esp-idf
sdkconfig_options:
CONFIG_BOOTLOADER_WDT_TIME_MS: "60000"
# Enable logging
logger:
hardware_uart: USB_SERIAL_JTAG
# Enable Home Assistant API
api:
encryption:
key: "44535345342523452354235dfasgfgdfatre="
web_server:
port: 80
version: 3
local: true
sorting_groups:
- id: sorting_group_lock_mac
name: "Lock Mac Address"
sorting_weight: -10
- id: sorting_group_lock_pair
name: "Lock Pair"
sorting_weight: -9
- id: sorting_group_lock_connect
name: "Lock Connect"
sorting_weight: -8
- id: sorting_group_lock_state
name: "Lock State"
sorting_weight: -7
- id: sorting_group_lock_settings
name: "Lock Settings"
sorting_weight: -6
ota:
- platform: esphome
password: "7ff7838674a21d7be6b41f404c399bd7"
safe_mode:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# output_power: 8.5
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Eqiva-Lock"
password: "12345678"
# Activate scan only after wifi connect, see https://github.com/esphome/issues/issues/2941#issuecomment-1842369092
on_connect:
- esp32_ble_tracker.start_scan:
continuous: true
- eqiva_key_ble.connect:
mac_address: !lambda 'return id(mac_address).state;'
user_id: !lambda 'return id(user_id).state;'
user_key: !lambda 'return id(user_key).state;'
on_disconnect:
- esp32_ble_tracker.stop_scan:
captive_portal:
external_components:
- source: github://digaus/esphome-components-eqiva
esp32_ble_tracker:
id: ble_tracker
scan_parameters:
window: 300ms
continuous: false
# used for discovering the lock and get the mac_address, check logger for it
eqiva_ble:
eqiva_key_ble:
id: key_ble
time:
- platform: sntp
id: sntptime
# ...
on_time:
# Every 4 minutes
- seconds: 0
minutes: /4
then:
- eqiva_key_ble.status:
button:
- platform: template
id: ble_settings
name: Connect
web_server:
sorting_weight: -1
sorting_group_id: sorting_group_lock_connect
icon: "mdi:access-point-check"
on_press:
- eqiva_key_ble.connect:
mac_address: !lambda 'return id(mac_address).state;'
user_id: !lambda 'return id(user_id).state;'
user_key: !lambda 'return id(user_key).state;'
- platform: template
id: ble_disconnect
name: Disconnect
web_server:
sorting_weight: -1
sorting_group_id: sorting_group_lock_connect
icon: "mdi:access-point-off"
on_press:
- eqiva_key_ble.disconnect:
- platform: template
id: ble_pair
name: Pair
web_server:
sorting_weight: -1
sorting_group_id: sorting_group_lock_pair
icon: "mdi:access-point-plus"
on_press:
- eqiva_key_ble.pair:
card_key: !lambda 'return id(card_key).state;'
mac_address: !lambda 'return id(mac_address).state;'
- platform: template
id: lock_settings
web_server:
sorting_weight: -1
sorting_group_id: sorting_group_lock_settings
name: Save
icon: "mdi:check-underline"
on_press:
- eqiva_key_ble.settings:
turn_left: !lambda 'return id(direction).state == "Left";'
key_horizontal: !lambda 'return id(position).state == "Horizontal";'
lock_turns: !lambda 'return atoi(id(turns).state.c_str());'
text:
- platform: template
icon: "mdi:info"
mode: text
name: User Key
web_server:
sorting_group_id: sorting_group_lock_connect
id: user_key
optimistic: true
restore_value: true
- platform: template
icon: "mdi:info"
mode: text
name: Mac Address
web_server:
sorting_group_id: sorting_group_lock_mac
id: mac_address
optimistic: true
restore_value: true
- platform: template
icon: "mdi:info"
mode: text
name: Pairing Card Key
web_server:
sorting_group_id: sorting_group_lock_pair
id: card_key
optimistic: true
number:
- platform: template
icon: "mdi:info"
mode: box
name: User ID
web_server:
sorting_group_id: sorting_group_lock_connect
id: user_id
max_value: 7
min_value: 0
step: 1
optimistic: true
restore_value: true
select:
- platform: template
icon: "mdi:info"
name: Close Direction
web_server:
sorting_group_id: sorting_group_lock_settings
id: direction
options:
- "Left"
- "Right"
optimistic: true
- platform: template
icon: "mdi:info"
name: Key Position
web_server:
sorting_group_id: sorting_group_lock_settings
id: position
options:
- "Vertical"
- "Horizontal"
optimistic: true
- platform: template
icon: "mdi:info"
name: Turns
web_server:
sorting_group_id: sorting_group_lock_settings
id: turns
options:
- "1"
- "2"
- "3"
- "4"
optimistic: true
text_sensor:
- platform: eqiva_key_ble
mac_address:
icon: "mdi:info"
name: "Mac Address"
web_server:
sorting_group_id: sorting_group_lock_state
lock_status:
icon: "mdi:info"
id: lock_state
name: "Lock State"
web_server:
sorting_group_id: sorting_group_lock_state
low_battery:
name: "Low Battery"
web_server:
sorting_group_id: sorting_group_lock_state
lock_ble_state:
name: "Lock BLE State"
icon: mdi:bluetooth-settings
web_server:
sorting_group_id: sorting_group_lock_state
user_id:
icon: "mdi:info"
name: "Current User ID"
web_server:
sorting_group_id: sorting_group_lock_state
user_key:
icon: "mdi:info"
name: "Current User Key"
web_server:
sorting_group_id: sorting_group_lock_state
lock:
- platform: template
icon: "mdi:lock"
web_server:
sorting_group_id: sorting_group_lock_state
name: "Lock"
lambda: |-
if (id(lock_state).state == "LOCKED") {
return LOCK_STATE_LOCKED;
} else if (id(lock_state).state == "UNLOCKED" || id(lock_state).state == "OPENED") {
return LOCK_STATE_UNLOCKED;
} else if(id(lock_state).state == "MOVING") {
return {};
} else if (id(lock_state).state == "UNKNOWN") {
return LOCK_STATE_JAMMED;
}
return LOCK_STATE_LOCKED;
lock_action:
- eqiva_key_ble.lock:
unlock_action:
- eqiva_key_ble.unlock:
open_action:
- eqiva_key_ble.open:
sensor:
- platform: internal_temperature
name: "Internal Temperature"
icon: mdi:thermometer
- platform: uptime
name: Uptime Sensor