substitutions:
# Name the device and it's entities
device: ble_gateway
device_name: blegateway1
esphome:
name: $device_name
comment: $device
platformio_options:
board_build.flash_mode: dio
esp32:
board: esp32-c3-devkitm-1
variant: esp32c3
framework:
type: arduino
version: 2.0.2
platform_version: https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.3/platform-espressif32-2.0.2.3.zip
external_components:
- source: github://myhomeiot/esphome-components
esp32_ble_tracker:
scan_parameters:
interval: 120ms
window: 100ms
# Enable logging
logger:
# Enable Home Assistant API
api:
reboot_timeout: 1h
ota:
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: on
reboot_timeout: 23min
manual_ip:
static_ip: 192.168.1.118
gateway: 192.168.1.1
subnet: 255.255.255.0
# Enable fallback hotspot in case wifi connection fails
ap:
ssid: "$device_name Fallback Hotspot"
password: !secret ap_password
ble_gateway:
id: $device_name
# devices:
# - mac_address: 01:23:45:67:89:AB
# - mac_address: !secret lywsd03mmc_mac
on_ble_advertise:
then:
- homeassistant.service:
service: ble_monitor.parse_data
data:
packet: !lambda return packet;
gateway_id: $device_name
- homeassistant.event:
event: esphome.on_ble_advertise
data:
packet: !lambda return packet;
binary_sensor:
- platform: homeassistant
id: ble_gateway_discovery
entity_id: binary_sensor.ble_gateway
attribute: discovery
on_state:
then:
lambda: id($device_name).set_discovery(x);
- platform: ble_presence
id: S21Ultra
mac_address: C8:BD:69:D5:87:46
name: "S21 Ultra(BT)"
- platform: ble_presence
id: GalaxyWatch4
mac_address: 60:3A:AF:E1:20:40
name: "Galaxy Watch4 Classic (4LQJ)"
text_sensor:
- platform: homeassistant
id: ble_gateway_devices
entity_id: binary_sensor.ble_gateway
attribute: devices
on_value:
then:
lambda: id($device_name).set_devices(x);
# IP address of device. Not really needed for HA (as HA already knows it), but for showing on the display during startup. The startup screen will leave on if no instance connects to the API.
- platform: wifi_info
ip_address:
name: $device_name IP address
id: ip_address
# ESPHome version used to compile the app
- platform: version
name: $device_name ESPHome Version
sensor:
# WiFi signals strength sensor
- platform: wifi_signal
name: $device_name WiFi Signal Sensor
update_interval: 60s
INFO Reading configuration /config/esphome/blegateway.yaml...
WARNING The selected Arduino framework version is not the recommended one. If there are connectivity or build issues please remove the manual version.
WARNING The selected Arduino framework version is not the recommended one. If there are connectivity or build issues please remove the manual version.
INFO Starting log output from 192.168.1.118 using esphome API
INFO Successfully connected to 192.168.1.118
[09:51:56][I][app:102]: ESPHome version 2022.11.2 compiled on Nov 24 2022, 00:39:09
[09:51:56][C][wifi:504]: WiFi:
[09:51:56][C][wifi:362]: Local MAC: 60:55:F9:74:3C:34
[09:51:56][C][wifi:363]: SSID: 'OpenWrt'[redacted]
[09:51:56][C][wifi:364]: IP Address: 192.168.1.118
[09:51:56][C][wifi:366]: BSSID: 10:44:00:48:26:28[redacted]
[09:51:56][C][wifi:367]: Hostname: 'blegateway1'
[09:51:56][C][wifi:369]: Signal strength: -24 dB ▂▄▆█
[09:51:56][C][wifi:373]: Channel: 6
[09:51:56][C][wifi:374]: Subnet: 255.255.255.0
[09:51:56][C][wifi:375]: Gateway: 192.168.1.1
[09:51:56][C][wifi:376]: DNS1: 0.0.0.0
[09:51:56][C][wifi:377]: DNS2: 0.0.0.0
[09:51:56][C][logger:293]: Logger:
[09:51:56][C][logger:294]: Level: DEBUG
[09:51:56][C][logger:295]: Log Baud Rate: 115200
[09:51:56][C][logger:296]: Hardware UART: UART0
[09:51:56][C][ble_gateway:055]: BLE Gateway: Discovery NO, 2 device(s) configured:
[09:51:56][C][ble_gateway:057]: MAC address: A4:C1:38:EC:AA:60
[09:51:56][C][ble_gateway:057]: MAC address: E4:AA:EC:5F:71:E5
[09:51:56][C][ble_presence:011]: BLE Presence 'S21 Ultra(BT)'
[09:51:56][C][ble_presence:011]: BLE Presence 'Galaxy Watch4 Classic (4LQJ)'
[09:51:56][C][version.text_sensor:021]: Version Text Sensor 'blegateway1 ESPHome Version'
[09:51:56][C][version.text_sensor:021]: Icon: 'mdi:new-box'
[09:51:56][C][esp32_ble_tracker:796]: BLE Tracker:
[09:51:56][C][esp32_ble_tracker:797]: Scan Duration: 300 s
[09:51:56][C][esp32_ble_tracker:798]: Scan Interval: 120.0 ms
[09:51:56][C][esp32_ble_tracker:799]: Scan Window: 100.0 ms
[09:51:56][C][esp32_ble_tracker:800]: Scan Type: ACTIVE
[09:51:56][C][esp32_ble_tracker:801]: Continuous Scanning: True
[09:51:56][C][mdns:103]: mDNS:
[09:51:56][C][mdns:104]: Hostname: blegateway1
[09:51:56][C][ota:093]: Over-The-Air Updates:
[09:51:56][C][ota:094]: Address: 192.168.1.118:3232
[09:51:56][C][ota:097]: Using Password.
[09:51:56][C][api:138]: API Server:
[09:51:56][C][api:139]: Address: 192.168.1.118:6053
[09:51:56][C][api:143]: Using noise encryption: NO
[09:51:56][C][homeassistant.binary_sensor:039]: Homeassistant Binary Sensor 'ble_gateway_discovery'
[09:51:56][C][homeassistant.binary_sensor:040]: Entity ID: 'binary_sensor.ble_gateway'
[09:51:56][C][homeassistant.binary_sensor:042]: Attribute: 'discovery'
[09:51:56][C][wifi_info:009]: WifiInfo IPAddress 'blegateway1 IP address'
[09:51:56][C][wifi_signal.sensor:009]: WiFi Signal 'blegateway1 WiFi Signal Sensor'
[09:51:56][C][wifi_signal.sensor:009]: Device Class: 'signal_strength'
[09:51:56][C][wifi_signal.sensor:009]: State Class: 'measurement'
[09:51:56][C][wifi_signal.sensor:009]: Unit of Measurement: 'dBm'
[09:51:56][C][wifi_signal.sensor:009]: Accuracy Decimals: 0
[09:51:56][C][homeassistant.text_sensor:023]: Homeassistant Text Sensor 'ble_gateway_devices'
[09:51:56][C][homeassistant.text_sensor:024]: Entity ID: 'binary_sensor.ble_gateway'
[09:51:56][C][homeassistant.text_sensor:026]: Attribute: 'devices'
[09:51:57][D][ble_gateway:063]: [A4:C1:38:EC:AA:60] Packet 043E2B0201000060AAEC38C1A41F12161A1860AAEC38C1A40C08CC1AE60A41F60F0B094154435F454341413630CB
[09:52:07][D][ble_gateway:063]: [A4:C1:38:EC:AA:60] Packet 043E2B0201000060AAEC38C1A41F12161A1860AAEC38C1A40C08CC1AE60A41F60F0B094154435F454341413630CB
[09:52:12][D][ble_gateway:063]: [A4:C1:38:EC:AA:60] Packet 043E2B0201000060AAEC38C1A41F12161A1860AAEC38C1A40C08CD1AEA0A42F70F0B094154435F454341413630CB
[09:52:16][D][sensor:127]: 'blegateway1 WiFi Signal Sensor': Sending state -23.00000 dBm with 0 decimals of accuracy
[09:52:17][D][ble_gateway:063]: [A4:C1:38:EC:AA:60] Packet 043E2B0201000060AAEC38C1A41F12161A1860AAEC38C1A40C08CD1AEA0A42F70F0B094154435F454341413630CB
[09:52:19][D][esp32_ble_tracker:812]: Found device F1:4D:CF:5E:3E:F1 RSSI=-95
[09:52:19][D][esp32_ble_tracker:833]: Address Type: RANDOM
[09:52:27][D][ble_gateway:063]: [A4:C1:38:EC:AA:60] Packet 043E2B0201000060AAEC38C1A41F12161A1860AAEC38C1A40C08CD1AEA0A42F70F0B094154435F454341413630CD
[09:52:32][D][ble_gateway:063]: [A4:C1:38:EC:AA:60] Packet 043E2B0201000060AAEC38C1A41F12161A1860AAEC38C1A40B08CD1AE30A41F80F0B094154435F454341413630CE