Move API checking to interval
This commit is contained in:
		@@ -197,20 +197,27 @@ script:
 | 
			
		||||
interval:
 | 
			
		||||
  - interval: 5s
 | 
			
		||||
    then:
 | 
			
		||||
      - logger.log: "Checking Voice Assistant is running"
 | 
			
		||||
      - if:
 | 
			
		||||
          condition:
 | 
			
		||||
            and:
 | 
			
		||||
              - api.connected:
 | 
			
		||||
              - switch.is_on: use_wake_word
 | 
			
		||||
              - not:
 | 
			
		||||
                  - voice_assistant.is_running
 | 
			
		||||
                  - api.connected:
 | 
			
		||||
          then:
 | 
			
		||||
            - logger.log: "Voice Assistant not running; restarting it"
 | 
			
		||||
            - 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
 | 
			
		||||
            - switch.turn_off: use_wake_word
 | 
			
		||||
            - delay: 1s
 | 
			
		||||
            - switch.turn_on: use_wake_word
 | 
			
		||||
            - delay: 1s
 | 
			
		||||
            - delay: 2s
 | 
			
		||||
            - light.turn_off:
 | 
			
		||||
                id: output_led
 | 
			
		||||
 | 
			
		||||
logger:
 | 
			
		||||
  level: DEBUG
 | 
			
		||||
@@ -219,22 +226,6 @@ 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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user