diff --git a/services/voice16Claude.yaml b/services/voice16Claude.yaml index fc5a1df..4f51b57 100644 --- a/services/voice16Claude.yaml +++ b/services/voice16Claude.yaml @@ -150,6 +150,8 @@ voice_assistant: - script.execute: rboot #- script.execute: reset_led on_client_connected: + - lambda: id(voice_assistant_phase) = 1; # connected again: clear "disconnected" state + - script.stop: rboot # cancel the pending reboot - delay: 1s # Give the api server time to settle - script.execute: start_wake_word on_client_disconnected: @@ -166,6 +168,7 @@ interval: - api.connected: - not: - voice_assistant.is_running: + - switch.is_off: stop_listen then: - script.execute: start_wake_word @@ -176,8 +179,10 @@ script: - delay: 180s - if: condition: - lambda: |- - return id(voice_assistant_phase) == 4; + and: + - lambda: 'return id(voice_assistant_phase) == 4;' + - not: + - api.connected: # only reboot if HA is still not connected then: - switch.turn_on: id: rbt @@ -227,17 +232,27 @@ script: - lambda: id(va).set_use_wake_word(false); - voice_assistant.stop: switch: - # - platform: restart - # name: Restart - # id: rbt - platform: template name: Stop Listen + id: stop_listen optimistic: true restore_mode: RESTORE_DEFAULT_OFF #entity_category: config on_turn_on: - - microphone.mute: mic_id - #- script.execute: stop_wake_word + # Stop streaming to HA completely instead of sending silence + - script.execute: stop_wake_word + - light.turn_off: led on_turn_off: - - microphone.unmute: mic_id - #- script.execute: listening_timeout \ No newline at end of file + - script.execute: start_wake_word + +start_wake_word script: add the switch.is_off condition. + - id: start_wake_word + then: + - if: + condition: + - not: + - voice_assistant.is_running: + - switch.is_off: stop_listen + then: + - lambda: id(va).set_use_wake_word(true); + - voice_assistant.start_continuous: \ No newline at end of file diff --git a/services/voices3mb4.yaml b/services/voices3mb4.yaml index a693098..e571d93 100644 --- a/services/voices3mb4.yaml +++ b/services/voices3mb4.yaml @@ -136,7 +136,9 @@ voice_assistant: - delay: 2s - script.execute: rboot #- script.execute: reset_led - on_client_connected: + on_client_connected: + - lambda: id(voice_assistant_phase) = 1; # connected again: clear "disconnected" state + - script.stop: rboot # cancel the pending reboot - delay: 1s # Give the api server time to settle - script.execute: start_wake_word on_client_disconnected: @@ -153,6 +155,7 @@ interval: - api.connected: - not: - voice_assistant.is_running: + - switch.is_off: stop_listen then: - script.execute: start_wake_word @@ -163,8 +166,10 @@ script: - delay: 180s - if: condition: - lambda: |- - return id(voice_assistant_phase) == 4; + and: + - lambda: 'return id(voice_assistant_phase) == 4;' + - not: + - api.connected: # only reboot if HA is still not connected then: - switch.turn_on: id: rbt @@ -214,17 +219,27 @@ script: - lambda: id(va).set_use_wake_word(false); - voice_assistant.stop: switch: - # - platform: restart - # #name: Restart - # id: rbt - - platform: template + - platform: template name: Stop Listen + id: stop_listen optimistic: true restore_mode: RESTORE_DEFAULT_OFF #entity_category: config on_turn_on: - - microphone.mute: echo_microphone - #- script.execute: stop_wake_word + # Stop streaming to HA completely instead of sending silence + - script.execute: stop_wake_word + - light.turn_off: led on_turn_off: - - microphone.unmute: echo_microphone - #- script.execute: listening_timeout \ No newline at end of file + - script.execute: start_wake_word + +start_wake_word script: add the switch.is_off condition. + - id: start_wake_word + then: + - if: + condition: + - not: + - voice_assistant.is_running: + - switch.is_off: stop_listen + then: + - lambda: id(va).set_use_wake_word(true); + - voice_assistant.start_continuous: \ No newline at end of file