diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml index f1cbbdb..8cc47bf 100644 --- a/Integrations/ESPHome/Core.yaml +++ b/Integrations/ESPHome/Core.yaml @@ -1,12 +1,13 @@ substitutions: - version: "26.7.8.4" + version: "26.7.8.5" device_description: ${name} made by Apollo Automation - version ${version}. # Default OTA password. Override in your device YAML by re-declaring # `substitutions: { ota_password: !secret _ota_password }` so each # device on your network uses a unique secret instead of the shared default. ota_password: "apolloautomation" - # Firmware variant identity: overridden to "true" by MSR-1_BLE.yaml so - # each image tracks its own OTA manifests. + # Firmware variant identity: overridden to "true" by MSR-1_BLE.yaml. Seeds + # the Bluetooth Proxy select on boot so it self-corrects to what is + # actually running after a failed or abandoned switch. ble_firmware: "false" # Default update channel on first boot (no stored user choice yet, i.e. a # fresh flash). The beta-channel builds override this to "Beta" (see @@ -18,6 +19,22 @@ substitutions: stable_manifest_base: "https://apolloautomation.github.io/MSR-1" beta_manifest_base: "https://github.com/ApolloAutomation/MSR-1/releases/download/beta-fw" +esphome: + # List form so package merging concatenates with each variant's own on_boot + # entries (mapping form would be replaced by the variant's block instead). + on_boot: + - priority: -100 + then: + # The Bluetooth Proxy select mirrors the firmware actually running, so + # a failed or abandoned switch snaps back to the truth on reboot. + - lambda: |- + if (std::string("${ble_firmware}") == "true") { + id(firmware_ble).publish_state("Enabled"); + } else { + id(firmware_ble).publish_state("Disabled"); + } + - script.execute: apply_ota_source + esp32: variant: esp32c3 flash_size: 4MB @@ -768,14 +785,29 @@ select: then: - script.execute: apply_ota_source + - platform: template + name: "Bluetooth Proxy" + id: firmware_ble + icon: mdi:bluetooth + entity_category: "config" + optimistic: true + restore_value: true + options: + - "Disabled" + - "Enabled" + initial_option: "Disabled" + on_value: + then: + - script.execute: apply_ota_source + script: - id: apply_ota_source - # Sets the OTA manifest URL from the Firmware Channel select - # (Stable/Beta) for the firmware variant this image was built as. + # Sets the OTA manifest URL from the two selectors: Bluetooth Proxy + # (Disabled/Enabled) x Firmware Channel (Stable/Beta). # Stable = GitHub Pages, Beta = rolling "beta" release assets. then: - lambda: |- - const bool ble = std::string("${ble_firmware}") == "true"; + const bool ble = id(firmware_ble).current_option() == "Enabled"; const bool beta = id(firmware_channel).current_option() == "Beta"; std::string url; if (beta) {