From d060aa8eb47b7cb7ace645d7423b5042d13cdd0d Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Thu, 23 Jan 2025 19:34:01 +0100 Subject: [PATCH] Restart btproxy if no scan within 10 minutes Mitigates https://github.com/esphome/issues/issues/6701 --- templates/btproxy.yaml | 8 ++++++++ templates/restart.yaml | 1 + 2 files changed, 9 insertions(+) diff --git a/templates/btproxy.yaml b/templates/btproxy.yaml index a639a1d..b528115 100644 --- a/templates/btproxy.yaml +++ b/templates/btproxy.yaml @@ -22,11 +22,19 @@ esp32_ble_tracker: - sensor.template.publish: id: ble_scans_finished state: !lambda 'return ++id(ble_scans);' + - script.execute: restart_after_delay bluetooth_proxy: id: btproxy active: true +script: + - id: restart_after_delay + mode: restart + then: + - delay: 10min + - button.press: restart_button + sensor: - platform: template name: "btproxy connections free" diff --git a/templates/restart.yaml b/templates/restart.yaml index cbd6ae4..e304e03 100644 --- a/templates/restart.yaml +++ b/templates/restart.yaml @@ -2,3 +2,4 @@ button: - platform: restart name: "ESP chip restart" entity_category: diagnostic + id: restart_button