From 7c313a1083b138681b58fdf6019ae7ceaea9d4b1 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 29 Jul 2017 11:42:15 -0700 Subject: [PATCH] Voice dialog: Handle when not hearing anything. --- src/dialogs/ha-voice-command-dialog.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/dialogs/ha-voice-command-dialog.html b/src/dialogs/ha-voice-command-dialog.html index 02d64f2750..b9cfa2da7c 100644 --- a/src/dialogs/ha-voice-command-dialog.html +++ b/src/dialogs/ha-voice-command-dialog.html @@ -171,14 +171,18 @@ Polymer({ this.recognition.abort(); var text = this.results.final || this.results.interim; this.results = null; + if (text === '') { + text = ''; + } this.push('_conversation', { who: 'user', text: text, error: true }); }.bind(this); this.recognition.onend = function () { + // Already handled by onerror + if (this.results == null) { + return; + } var text = this.results.final || this.results.interim; this.results = null; - - if (text === '') return; - this.push('_conversation', { who: 'user', text: text }); this.hass.callApi('post', 'conversation/process', { text: text })