From 6f0cc863120d7c404dada67c7a30bf8760ffcad5 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 16 Dec 2023 04:15:25 -0500 Subject: [PATCH] Revert "Move API checking to interval" This reverts commit d98619b1e43cdcfb0aae059452edcb2ccd0bfc19. --- supersensor.yaml | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/supersensor.yaml b/supersensor.yaml index 9aa99c4..5f380df 100644 --- a/supersensor.yaml +++ b/supersensor.yaml @@ -197,27 +197,20 @@ script: interval: - interval: 5s then: + - logger.log: "Checking Voice Assistant is running" - if: condition: and: + - api.connected: + - switch.is_on: use_wake_word - not: - - api.connected: + - voice_assistant.is_running then: - - light.turn_on: - id: output_led - effect: flash_white - - switch.turn_off: use_wake_word - else: - # This absolute absurdity is required to prevent - # "no wake word detected" failure loops. - - switch.turn_on: use_wake_word - - delay: 1s + - logger.log: "Voice Assistant not running; restarting it" - switch.turn_off: use_wake_word - delay: 1s - switch.turn_on: use_wake_word - - delay: 2s - - light.turn_off: - id: output_led + - delay: 1s logger: level: DEBUG @@ -226,6 +219,22 @@ logger: api: encryption: key: !secret api_encryption_key + on_client_disconnected: + - light.turn_on: + id: output_led + effect: flash_white + - switch.turn_off: use_wake_word + on_client_connected: + # This absolute absurdity is required to prevent + # "no wake word detected" failure loops. + - switch.turn_on: use_wake_word + - delay: 2s + - switch.turn_off: use_wake_word + - delay: 2s + - switch.turn_on: use_wake_word + - delay: 2s + - light.turn_off: + id: output_led ota: password: !secret ota_password