Skip to content

Commit

Permalink
shutdown bluetooth during ota flashing
Browse files Browse the repository at this point in the history
  • Loading branch information
Heinz committed Jan 19, 2024
1 parent 1385dbf commit 34b0975
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 4 deletions.
8 changes: 8 additions & 0 deletions esp32-ble-example-multiple-devices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ wifi:
password: !secret wifi_password

ota:
on_begin:
then:
- lambda: |-
id(bluetooth_client0_enabled_switch).turn_off();
id(bluetooth_client1_enabled_switch).turn_off();
- logger.log: "BLE shutdown for flashing"

logger:
level: DEBUG
Expand Down Expand Up @@ -189,9 +195,11 @@ switch:

- platform: ble_client
ble_client_id: client0
id: bluetooth_client0_enabled_switch
name: "${bms0} enable bluetooth connection"
- platform: ble_client
ble_client_id: client1
id: bluetooth_client1_enabled_switch
name: "${bms1} enable bluetooth connection"

text_sensor:
Expand Down
8 changes: 7 additions & 1 deletion esp32-ble-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ wifi:
password: !secret wifi_password

ota:

on_begin:
then:
- lambda: |-
id(bluetooth_enabled_switch).turn_off();
- logger.log: "BLE shutdown for flashing"

logger:
level: DEBUG

Expand Down Expand Up @@ -271,6 +276,7 @@ switch:

- platform: ble_client
ble_client_id: client0
id: bluetooth_enabled_switch
name: "${name} enable bluetooth connection"

text_sensor:
Expand Down
8 changes: 7 additions & 1 deletion esp32-ble-jk04-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ wifi:
password: !secret wifi_password

ota:

on_begin:
then:
- lambda: |-
id(bluetooth_enabled_switch).turn_off();
- logger.log: "BLE shutdown for flashing"

logger:
level: DEBUG

Expand Down Expand Up @@ -207,4 +212,5 @@ switch:

- platform: ble_client
ble_client_id: client0
id: bluetooth_enabled_switch
name: "${name} enable bluetooth connection"
8 changes: 7 additions & 1 deletion esp32-ble-uart-hybrid-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ wifi:
password: !secret wifi_password

ota:

on_begin:
then:
- lambda: |-
id(bluetooth_enabled_switch).turn_off();
- logger.log: "BLE shutdown for flashing"

logger:
level: DEBUG

Expand Down Expand Up @@ -210,6 +215,7 @@ switch:

- platform: ble_client
ble_client_id: client0
id: bluetooth_enabled_switch
name: "${name} enable bluetooth connection"

text_sensor:
Expand Down
6 changes: 6 additions & 0 deletions esp32-ble-v11-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ wifi:
password: !secret wifi_password

ota:
on_begin:
then:
- lambda: |-
id(bluetooth_enabled_switch).turn_off();
- logger.log: "BLE shutdown for flashing"

logger:
level: DEBUG
Expand Down Expand Up @@ -277,6 +282,7 @@ switch:

- platform: ble_client
ble_client_id: client0
id: bluetooth_enabled_switch
name: "${name} enable bluetooth connection"

text_sensor:
Expand Down
7 changes: 7 additions & 0 deletions yaml-snippets/esp32-ble-block-traffic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ wifi:
password: !secret wifi_password

ota:
on_begin:
then:
- lambda: |-
id(bluetooth_enabled_switch).turn_off();
- logger.log: "BLE shutdown for flashing"

logger:

# If you don't use Home Assistant please remove this `api` section and uncomment the `mqtt` component!
Expand All @@ -43,4 +49,5 @@ ble_client:
switch:
- platform: ble_client
ble_client_id: client0
id: bluetooth_enabled_switch
name: "${name} enable bluetooth connection"
8 changes: 7 additions & 1 deletion yaml-snippets/esp32-ble-energy-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ wifi:
password: !secret wifi_password

ota:

on_begin:
then:
- lambda: |-
id(bluetooth_enabled_switch).turn_off();
- logger.log: "BLE shutdown for flashing"

logger:
level: DEBUG

Expand Down Expand Up @@ -94,4 +99,5 @@ sensor:
switch:
- platform: ble_client
ble_client_id: client0
id: bluetooth_enabled_switch
name: "${name} enable bluetooth connection"

0 comments on commit 34b0975

Please sign in to comment.