Merge pull request #69 from nkm8/main

Add BLE proxy; remove throttles
This commit is contained in:
Aiden
2026-01-19 14:34:16 +08:00
committed by GitHub
+33 -66
View File
@@ -3,8 +3,8 @@ substitutions:
friendly_name: "PS02C3MZ Sensor"
room: ""
device_description: "athom esp32c3 ld2450 motion target tracking sensor"
project_name: "Athom Technology.PS02C3MZ LD2450"
project_version: "v2.0.3"
project_name: "China Athom Technology.PS02C3MZ LD2450"
project_version: "v2.0.4"
update_interval: 60s
# 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: ""
@@ -39,9 +39,18 @@ esphome:
esp32:
board: esp32-c3-devkitm-1
flash_size: 4MB
variant: ESP32C3
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
# Also enable this on any derivative boards (S2, C3 etc) but not the original ESP32.
CONFIG_BT_BLE_50_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 logging
logger:
@@ -55,9 +64,6 @@ mdns:
web_server:
port: 80
# Enable Home Assistant API
api:
ota:
- platform: esphome
@@ -74,6 +80,27 @@ wifi:
captive_portal:
esp32_ble_tracker:
scan_parameters:
# Don't auto start BLE scanning, we control it in the `api` block's automation.
continuous: false
active: true # send scan-request packets to gather more info, like device name for some devices.
interval: 320ms # default 320ms - how long to spend on each advert channel
window: 300ms # default 30ms - how long to actually "listen" in each interval. Reduce this if device is unstable.
# If the device cannot keep up or becomes unstable, reduce the "window" setting. This may be
# required if your device is controlling other sensors or doing PWM for lights etc.
# Enable Home Assistant API
api:
on_client_connected:
- esp32_ble_tracker.start_scan:
continuous: true
on_client_disconnected:
- esp32_ble_tracker.stop_scan:
bluetooth_proxy:
active: true
esp32_improv:
authorizer: none
@@ -136,159 +163,99 @@ sensor:
target_count:
name: Presence Target Count
id: target_count
filters:
- throttle: 1000ms
still_target_count:
name: Still Target Count
id: still_target_count
filters:
- throttle: 1000ms
moving_target_count:
name: Moving Target Count
id: moving_target_count
filters:
- throttle: 1000ms
target_1:
x:
name: Target-1 X
id: target_1_x
filters:
- throttle: 1000ms
y:
name: Target-1 Y
id: target_1_y
filters:
- throttle: 1000ms
speed:
name: Target-1 Speed
id: target_1_speed
filters:
- throttle: 1000ms
angle:
name: Target-1 Angle
id: target_1_angle
filters:
- throttle: 1000ms
distance:
name: Target-1 Distance
id: target_1_distance
filters:
- throttle: 1000ms
resolution:
name: Target-1 Resolution
id: target_1_resolution
filters:
- throttle: 1000ms
target_2:
x:
name: Target-2 X
id: target_2_x
filters:
- throttle: 1000ms
y:
name: Target-2 Y
id: target_2_y
filters:
- throttle: 1000ms
speed:
name: Target-2 Speed
id: target_2_speed
filters:
- throttle: 1000ms
angle:
name: Target-2 Angle
id: target_2_angle
filters:
- throttle: 1000ms
distance:
name: Target-2 Distance
id: target_2_distance
filters:
- throttle: 1000ms
resolution:
name: Target-2 Resolution
id: target_2_resolution
filters:
- throttle: 1000ms
target_3:
x:
name: Target-3 X
id: target_3_x
filters:
- throttle: 1000ms
y:
name: Target-3 Y
id: target_3_y
filters:
- throttle: 1000ms
speed:
name: Target-3 Speed
id: target_3_speed
filters:
- throttle: 1000ms
angle:
name: Target-3 Angle
id: target_3_angle
filters:
- throttle: 1000ms
distance:
name: Target-3 Distance
id: target_3_distance
filters:
- throttle: 1000ms
resolution:
name: Target-3 Resolution
id: target_3_resolution
filters:
- throttle: 1000ms
zone_1:
target_count:
name: Zone-1 All Target Count
id: zone_1_target_count
filters:
- throttle: 1000ms
still_target_count:
name: Zone-1 Still Target Count
id: zone_1_still_target_count
filters:
- throttle: 1000ms
moving_target_count:
name: Zone-1 Moving Target Count
id: zone_1_moving_target_count
filters:
- throttle: 1000ms
zone_2:
target_count:
name: Zone-2 All Target Count
id: zone_2_target_count
filters:
- throttle: 1000ms
still_target_count:
name: Zone-2 Still Target Count
id: zone_2_still_target_count
filters:
- throttle: 1000ms
moving_target_count:
name: Zone-2 Moving Target Count
id: zone_2_moving_target_count
filters:
- throttle: 1000ms
zone_3:
target_count:
name: Zone-3 All Target Count
id: zone_3_target_count
filters:
- throttle: 1000ms
still_target_count:
name: Zone-3 Still Target Count
id: zone_3_still_target_count
filters:
- throttle: 1000ms
moving_target_count:
name: Zone-3 Moving Target Count
id: zone_3_moving_target_count
filters:
- throttle: 1000ms
- platform: uptime
name: "Uptime Sensor"
@@ -465,4 +432,4 @@ time:
then:
- text_sensor.template.publish:
id: device_last_restart
state: !lambda 'return id(sntp_time).now().strftime("%a %d %b %Y - %I:%M:%S %p");'
state: !lambda 'return id(sntp_time).now().strftime("%a %d %b %Y - %I:%M:%S %p");'