forked from athom-tech/esp32-configs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathathom-zigbee-gateway.yaml
More file actions
220 lines (192 loc) · 5.85 KB
/
Copy pathathom-zigbee-gateway.yaml
File metadata and controls
220 lines (192 loc) · 5.85 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
substitutions:
# Default name
name: "athom-zigbee-gateway"
# Default friendly name
friendly_name: "Athom Zigbee Gateway"
# Allows ESP device to be automatically linked to an 'Area' in Home Assistant. Typically used for areas such as 'Lounge Room', 'Kitchen' etc
room: ""
# Description as appears in ESPHome & top of webserver page
device_description: "athom eth zigbee gateway"
# Project Name
project_name: "China Athom Technology.Athom Zigbee Gateway"
# Projection version denotes the release version of the yaml file, allowing checking of deployed vs latest version
project_version: "v2.0.10"
# Define a domain for this device to use. i.e. iot.home.lan (so device will appear as athom-smart-plug-v2.iot.home.lan in DNS/DHCP logs)
dns_domain: ".local"
# Set timezone of the smart plug. Useful if the plug is in a location different to the HA server. Can be entered in unix Country/Area format (i.e. "Australia/Sydney")
timezone: ""
# Define logging level: NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE
log_level: "DEBUG"
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
comment: "${device_description}"
area: "${room}"
name_add_mac_suffix: true
project:
name: "${project_name}"
version: "${project_version}"
platformio_options:
# board_build.mcu: esp32dev
# board_build.variant: esp32dev
board_build.flash_mode: dio
esp32:
board: esp32dev
flash_size: 4MB
framework:
type: esp-idf
version: recommended
sdkconfig_options:
# @grigi found in testing that these options resulted in better responsiveness.
# BLE 4.2 is supported by ALL ESP32 boards that have bluetooth, the original and derivatives.
CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y
# Extend the watchdog timeout, so the device reboots if the device appears locked up for over 10 seconds.
CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
# Enable Home Assistant API
api:
reboot_timeout: 0s
on_client_connected:
- esp32_ble_tracker.start_scan:
continuous: true
# Disable BLE tracking when there are no api connections live
on_client_disconnected:
if:
condition:
not:
api.connected:
then:
- esp32_ble_tracker.stop_scan:
external_components:
- source: github://athom-tech/esp32-configs@main
components: [stream_server]
refresh: 0s
dashboard_import:
package_import_url: github://athom-tech/esp32-configs/athom-zigbee-gateway.yaml
esp32_ble_tracker:
scan_parameters:
interval: 320ms
window: 320ms
active: true
bluetooth_proxy:
active: true
#WT32-ETH01 Ethernet
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk:
pin: GPIO17
mode: CLK_OUT
phy_addr: 1
# wifi:
# # This spawns an AP with the device name and mac address with no password.
# ap: {}
# # Allow rapid re-connection to previously connect WiFi SSID, skipping scan of all SSID
# fast_connect: "${wifi_fast_connect}"
# # Define dns domain / suffix to add to hostname
# domain: "${dns_domain}"
# captive_portal:
# Enable logging
logger:
baud_rate: 115200
level: ${log_level}
ota:
- platform: esphome
id: ota_esphome
# Enables OTA firmware flashing from a URL (used by the update component below)
- platform: http_request
id: ota_http_request
# Required by the ota http_request platform and the update component.
# verify_ssl: false skips TLS cert validation to reduce heap/RAM pressure during
# the download; the manifest's MD5 still verifies firmware integrity before flashing.
http_request:
id: http_request_component
verify_ssl: false
update:
# Managed updates via HTTP request: periodically checks the published manifest
# and exposes a "Firmware Update" entity, pointing at this device's GitHub Pages
# manifest. Pages URLs avoid the redirect/buffer issues of Release download URLs.
- platform: http_request
id: update_http_request
name: "Firmware Update"
source: https://athom-tech.github.io/esp32-configs/firmware/athom-zigbee-gateway.manifest.json
# update_interval defaults to 6h (how often it checks, not installs)
web_server:
port: 80
local: True
switch:
- platform: gpio
pin: 32
id: zRST_gpio
inverted: yes
restore_mode: ALWAYS_OFF
- platform: gpio
pin: 33
name: "zBSL"
id: zBSL
inverted: yes
restore_mode: ALWAYS_OFF
- platform: template
name: "Prep the cc2652p2 for firmware update"
turn_on_action:
- script.execute: fw_update_mode
turn_off_action:
- button.press: zRST
button:
- platform: restart
name: "Restart the Device"
- platform: template
name: "Zigbee Module Restart"
id: zRST
on_press:
- switch.turn_on: zRST_gpio
- delay: 15ms
- switch.turn_off: zRST_gpio
uart:
id: uart_bus
rx_pin: GPIO14
tx_pin: GPIO12
baud_rate: 115200
stream_server:
uart_id: uart_bus
id: ss
port: 8888 # optional, default is 8888
binary_sensor:
- platform: stream_server
connected:
name: "AthomZB Serial Connected"
- platform: status
name: "Status"
entity_category: diagnostic
mdns:
services:
- service: "_athomzb"
protocol: "_tcp"
port: 8888
txt:
version: 1.0
name: AthomZB
radio_type: znp
baud_rate: 115200
data_flow_control: software
light:
- platform: status_led
name: "Status LED"
id: blue_led
disabled_by_default: true
pin:
inverted: true
number: GPIO15
script:
- id: fw_update_mode
then:
- switch.turn_on: zBSL
- delay: 1s
- switch.turn_on: zRST_gpio
- delay: 1s
- switch.turn_off: zRST_gpio
- logger.log: "Delaying ~10 seconds for cc2652p2 to settle"
- delay: 11s
- switch.turn_off: zBSL
- logger.log: "Please try update with cc2538-bsl tool now"
- logger.log: "cc-bsl usage: cc2538-bsl.py -p socket://ip-of-gw:8888 -evw firmware.hex"