Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New factory Reset Process #224

Merged
merged 4 commits into from
Dec 18, 2024
Merged

New factory Reset Process #224

merged 4 commits into from
Dec 18, 2024

Conversation

jlpouffier
Copy link
Contributor

⚠️: Requires #223

A new factory reset process prompting the user to release the button to reset the device to prevent entering the bootloader mode.

  • Long press center button for 10 seconds
    • Audible factory_reset_initiated_sound warning
    • LED animation
    • If released here
      • Audible factory_reset_cancelled_sound sound
  • Long press center button for 22 seconds
    • 🆕 Audible factory_reset_confirmed_sound warning
    • 🆕 If released here
      • factory reset

⁉️ Why are you using a global factory_reset_requested?, why not simply

  - wait_until:
      binary_sensor.is_off: center_button

👉🏻 Good question, I initially did that, but the factory reset is a 22-second press and before that, we have the first audible warning at 10s that already has a wait_until block to inform the user that the factory reset was canceled.

Because the factory reset is critical, I do not want to have two things running in parallel, especially when the second one is the seeker streaming "Factory reset procedure canceled"

So it is cleaner that way.
If the 22s-press happens, I stop the LED effect and set a global to true.

And I factory reset outside this multi-click.
Here

    on_release:
      - script.execute: control_leds
      # If a factory reset is requested, factory reset on release
      - if:
          condition:
            lambda: return id(factory_reset_requested);
          then:
            - button.press: factory_reset_button

This global also prevents the streaming of the "Factory reset procedure cancelled". It's either one or the other.

The state of the global is never saved, and always initiated to false.

@jlpouffier jlpouffier marked this pull request as draft December 18, 2024 13:37
@jlpouffier jlpouffier marked this pull request as ready for review December 18, 2024 13:40
Copy link

Firmware built successfully! 🎉

Download and extract the firmware to install with https://web.esphome.io

Make sure to choose home-assistant-voice-esp32s3.factory.bin.

@kahrendt kahrendt enabled auto-merge (squash) December 18, 2024 14:26
@kahrendt kahrendt merged commit 26afb20 into dev Dec 18, 2024
5 checks passed
@kahrendt kahrendt deleted the new-factory-reset-process branch December 18, 2024 14:35
Copy link

Firmware built successfully! 🎉

Download and extract the firmware to install with https://web.esphome.io

Make sure to choose home-assistant-voice-esp32s3.factory.bin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants