# Deaf-satellite watchdog workaround — from esphome issue #22361 (the issue
# author's "dead-man's switch", quoted verbatim from the issue body). For
# ESPHome releases that do NOT yet carry the merged fixes #22394/#22393
# (i.e. 2026.11.0 and 2026.11.1 at last check 2026-11-30; the fixes sit on
# the dev branch and are first expected in 2026.12.0 — re-check the changelog). Reported working
# on 2026.7.x-2026.11.x; costs up to 30 s of deafness per event while it waits
# for the next interval tick.
#
# Requires: a select entity id wake_word_engine_location showing "On device",
# and ids mww (micro_wake_word) / va (voice_assistant) / echo_speaker (speaker).
# Swap those ids for the ones in your own config before use.
# Source: https://github.com/esphome/esphome/issues/22361
# Served by MCU Atlas — /projects/esphome-wake-word-voice-assistants-for-home-assistant/
interval:
  - interval: 30s
    then:
      - if:
          condition:
            and:
              - lambda: return id(wake_word_engine_location).current_option() == "On device";
              - not:
                  micro_wake_word.is_running:
                    id: mww
              - not:
                  voice_assistant.is_running:
                    id: va
              - not:
                  speaker.is_playing:
                    id: echo_speaker
          then:
            - micro_wake_word.start:
                id: mww
