Apologies for the delay, I had spent a while writing out a tutorial on how to get going with ESPHome etc. but was unable to finish it. When I came back to it my draft message was gone so I gave up.
I’ll make this one brief.
I’m using an M5 Stack Atom Lite and here is my ESPHome yaml for it with MACs, PINs and keys partially redacted using “XX”:
# Define reusable constants here
substitutions:
name: "iot-atom-ble-proxy-30XXXX"
friendly_name: Bluetooth Proxy 30XXXX
tv_mount_mac_address: 34:15:13:DA:XX:XX
kitchen_extractor_mac_address: 4C:96:2D:12:XX:XX
bathroom_extractor_mac_address: 58:2b:db:01:XX:XX
shower_extractor_mac_address: 58:2b:db:01:XX:XX
# The core firmware to build on
packages:
esphome.bluetooth-proxy: github://esphome/firmware/bluetooth-proxy/m5stack-atom-lite.yaml@main
# Name this node/Atom Lite
esphome:
name: ${name}
name_add_mac_suffix: false
friendly_name: ${friendly_name}
# The encryption key to authenticate this node
api:
encryption:
key: XXXX/LOlXzS+XXXXXXXXXXXXXXXXX=
# Wifi credentials
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Maximum 3 active BLE clients on the Atom Lite (it struggles with 4+)
ble_client:
# Vent Axia PureAir Sense
- mac_address: ${kitchen_extractor_mac_address}
id: KITCHEN_EXTRACTOR
auto_connect: false
# Debug logging, shown in the node logs
on_connect:
then:
- lambda: |-
ESP_LOGD("ble_client_lambda", "Connected to Kitchen Extractor");
# Debug logging, shown in the node logs
on_disconnect:
then:
- lambda: |-
ESP_LOGD("ble_client_lambda", "Disconnected from Kitchen Extractor");
# Vent Axia Svara
- mac_address: ${bathroom_extractor_mac_address}
id: BATHROOM_EXTRACTOR
auto_connect: false
on_connect:
then:
- lambda: |-
ESP_LOGD("ble_client_lambda", "Connected to Bathroom Extractor");
on_disconnect:
then:
- lambda: |-
ESP_LOGD("ble_client_lambda", "Disconnected from Bathroom Extractor");
# Vogels Motion Mount (unrelated to extractors)
- mac_address: ${tv_mount_mac_address}
id: TV_MOUNT
auto_connect: false
on_connect:
then:
- lambda: |-
ESP_LOGD("ble_client_lambda", "Connected to TV mount");
on_disconnect:
then:
- lambda: |-
ESP_LOGD("ble_client_lambda", "Disconnected from TV mount");
# Commented out due to 3 client limit, also a Vent Axia Svara
#- mac_address: ${shower_extractor_mac_address}
# id: SHOWER_EXTRACTOR
# auto_connect: false
# on_connect:
# then:
# - lambda: |-
# ESP_LOGD("ble_client_lambda", "Connected to Shower Extractor");
# on_disconnect:
# then:
# - lambda: |-
# ESP_LOGD("ble_client_lambda", "Disconnected from Shower Extractor");
# Add the sensors that will be discovered by Home Assistant
sensor:
- platform: ble_rssi
name: kitchen_extractor_rssi
mac_address: ${kitchen_extractor_mac_address}
- platform: ble_rssi
name: bathroom_extractor_rssi
mac_address: ${bathroom_extractor_mac_address}
- platform: ble_rssi
name: tv_mount_rssi
mac_address: ${tv_mount_mac_address}
# Add buttons to perform simple trigger actions in Home Assistant
button:
- platform: template
name: Boost Kitchen Extractor
on_press:
then:
# Stop the background BLE scanning
- esp32_ble_tracker.stop_scan:
# Connect to the PureAir Sense
- ble_client.connect: KITCHEN_EXTRACTOR
# Authenticate with PIN (change the value to match yours)
- ble_client.ble_write:
id: KITCHEN_EXTRACTOR
service_uuid: e6834e4b-7b3a-48e6-91e4-f1d005f564d3
characteristic_uuid: 4cad343a-209a-40b7-b911-4d9b3df569b2
value: [0xXX, 0x58, 0x82, 0x01]
# Cancel any current boost time remaining
- ble_client.ble_write:
id: KITCHEN_EXTRACTOR
service_uuid: c119e858-0531-4681-9674-5a11f0e53bb4
characteristic_uuid: 7c4adc07-2f33-11e7-93ae-92361f002671
value: [0x00, 0x00, 0x00, 0x00, 0x00]
# Send the boost command
- ble_client.ble_write:
id: KITCHEN_EXTRACTOR
service_uuid: c119e858-0531-4681-9674-5a11f0e53bb4
characteristic_uuid: 7c4adc07-2f33-11e7-93ae-92361f002671
value: [0x01, 0xC4, 0x09, 0x58, 0x02]
# Disconnect from the Pure Sense
- ble_client.disconnect: KITCHEN_EXTRACTOR
# Restart the background BLE scanning
- esp32_ble_tracker.start_scan:
# Debug logging, shown in the node logs
- logger.log: Boost Kitchen Extractor button finished
- platform: template
name: Boost Bathroom Extractor
on_press:
then:
# Stop the background BLE scanning
- esp32_ble_tracker.stop_scan:
# Connect to the Svara
- ble_client.connect: BATHROOM_EXTRACTOR
# Authenticate with PIN (change the value to match yours)
- ble_client.ble_write:
id: BATHROOM_EXTRACTOR
service_uuid: e6834e4b-7b3a-48e6-91e4-f1d005f564d3
characteristic_uuid: 4cad343a-209a-40b7-b911-4d9b3df569b2
value: [0xXX, 0x14, 0xf7, 0x01]
# Cancel any current boost time remaining
- ble_client.ble_write:
id: BATHROOM_EXTRACTOR
service_uuid: c119e858-0531-4681-9674-5a11f0e53bb4
characteristic_uuid: 118c949c-28c8-4139-b0b3-36657fd055a9
value: [0x00, 0x00, 0x00, 0x00, 0x00]
# Send the boost command
- ble_client.ble_write:
id: BATHROOM_EXTRACTOR
service_uuid: c119e858-0531-4681-9674-5a11f0e53bb4
characteristic_uuid: 118c949c-28c8-4139-b0b3-36657fd055a9
value: [0x01, 0x60, 0x09, 0x2C, 0x01]
# Disconnect from the Svara
- ble_client.disconnect: BATHROOM_EXTRACTOR
# Restart the background BLE scanning
- esp32_ble_tracker.start_scan:
# Debug logging, shown in the node logs
- logger.log: Boost Bathroom Extractor button finished
- platform: template
name: Extend TV Mount
on_press:
then:
- esp32_ble_tracker.stop_scan:
- ble_client.connect: TV_MOUNT
- ble_client.ble_write:
id: TV_MOUNT
service_uuid: 3e6fe65d-ed78-11e4-895e-00026fd5c52c
characteristic_uuid: c005fa00-0651-4800-b000-000000000000
value: [0x00, 0x64]
- ble_client.disconnect: TV_MOUNT
- esp32_ble_tracker.start_scan:
- logger.log: Extend TV Mount button finished
- platform: template
name: Retract TV Mount
on_press:
then:
- esp32_ble_tracker.stop_scan:
- ble_client.connect: TV_MOUNT
- ble_client.ble_write:
id: TV_MOUNT
service_uuid: 3e6fe65d-ed78-11e4-895e-00026fd5c52c
characteristic_uuid: c005fa00-0651-4800-b000-000000000000
value: [0x00, 0x00]
- ble_client.disconnect: TV_MOUNT
- esp32_ble_tracker.start_scan:
- logger.log: Retract TV Mount button finished