diff --git a/css/extension.css b/css/extension.css index 9cca15b7..38a14ed6 100644 --- a/css/extension.css +++ b/css/extension.css @@ -577,6 +577,7 @@ } +#extension-voco-mqtt-error, #extension-voco-injection-failure, #extension-voco-debug-warning{ max-width:60rem; diff --git a/js/extension.js b/js/extension.js index d5b28767..488dad54 100644 --- a/js/extension.js +++ b/js/extension.js @@ -192,11 +192,11 @@ if('is_satellite' in body){ if(body['is_satellite'] == false){ - document.getElementById('extension-voco-content-container').classList.add('extension-voco-add-token'); + //document.getElementById('extension-voco-content-container').classList.add('extension-voco-add-token'); } } else{ - document.getElementById('extension-voco-content-container').classList.add('extension-voco-add-token'); + //document.getElementById('extension-voco-content-container').classList.add('extension-voco-add-token'); } @@ -341,7 +341,7 @@ if('possible_injection_failure' in body && 'mqtt_connected' in body){ if(body.mqtt_connected == false){ - document.getElementById("extension-voco-mqtt-error").style.display = 'block'; + //document.getElementById("extension-voco-mqtt-error").style.display = 'block'; } else if(body.possible_injection_failure){ document.getElementById("extension-voco-injection-failure").style.display = 'block'; diff --git a/manifest.json b/manifest.json index cb077747..df90bb04 100644 --- a/manifest.json +++ b/manifest.json @@ -72,7 +72,7 @@ "Auto", "Headphone jack", "HDMI", - "Bluetooth" + "Bluetooth speaker" ], "type": "string" }, @@ -185,16 +185,12 @@ "type": "boolean" } }, - "required": [ - "Microphone", - "Speaker", - "Authorization token" - ], + "required": [], "type": "object" } }, "short_name": "Voco", - "version": "2.8.15", + "version": "2.8.17", "web_accessible_resources": [ "css/*.css", "images/*.svg", diff --git a/pkg/voco_adapter.py b/pkg/voco_adapter.py index fb3576e1..a84d3296 100644 --- a/pkg/voco_adapter.py +++ b/pkg/voco_adapter.py @@ -258,7 +258,7 @@ def __init__(self, verbose=True): self.sample_rate = 16000 # Bluetooth - self.bluealsa = False + self.bluealsa_available = False self.kill_ffplay_before_speaking = False @@ -434,6 +434,9 @@ def __init__(self, verbose=True): print(str(self.persistent_data)) + # If Bluealsa is detected, then this will add bluetooth as an option to the output dropdown of the thing + self.bluetooth_device_check() + # Create Voco device try: @@ -574,7 +577,7 @@ def __init__(self, verbose=True): if self.DEBUG: print("Setting Pi audio_output to HDMI") run_command("amixer cset numid=3 2") - elif self.speaker == "Bluetooth": + elif self.speaker == "Bluetooth speaker": if self.DEBUG: print("Setting Pi audio_output to Bluetooth") time.sleep(10) # give BluetoothPairing some time to reconnect to the speaker @@ -726,7 +729,7 @@ def bluetooth_device_check(self): print("aplay_pcm_check: " + str(aplay_pcm_check)) if 'bluealsa' in aplay_pcm_check: - self.bluealsa = True + self.bluealsa_available = True if self.DEBUG: print("BlueAlsa was detected as PCM option") @@ -1140,37 +1143,47 @@ def set_audio_output(self, selection): if self.DEBUG: print("Setting audio_output selection to: " + str(selection)) - # Get the latest audio controls - self.audio_controls = get_audio_controls() - if self.DEBUG: - print(self.audio_controls) + if selection == 'Bluetooth speaker': + + self.bluetooth_device_check() + + self.persistent_data['audio_output'] = str(selection) + self.save_persistent_data() + + self.devices['voco'].properties['audio_output'].update( str(selection) ) + + else: + # Get the latest audio controls + self.audio_controls = get_audio_controls() + if self.DEBUG: + print(self.audio_controls) - try: - for option in self.audio_controls: - if str(option['human_device_name']) == str(selection): + try: + for option in self.audio_controls: + if str(option['human_device_name']) == str(selection): - self.current_simple_card_name = option['simple_card_name'] - self.current_card_id = option['card_id'] - self.current_device_id = option['device_id'] + self.current_simple_card_name = option['simple_card_name'] + self.current_card_id = option['card_id'] + self.current_device_id = option['device_id'] - # Set selection in persistence data - self.persistent_data['audio_output'] = str(selection) - self.save_persistent_data() + # Set selection in persistence data + self.persistent_data['audio_output'] = str(selection) + self.save_persistent_data() - if self.DEBUG: - print("new output selection on thing: " + str(selection)) - try: if self.DEBUG: - print("self.devices = " + str(self.devices)) - if self.devices['voco'] != None: - self.devices['voco'].properties['audio_output'].update( str(selection) ) - except Exception as ex: - print("Error setting new audio_output selection:" + str(ex)) + print("new output selection on thing: " + str(selection)) + try: + if self.DEBUG: + print("self.devices = " + str(self.devices)) + if self.devices['voco'] != None: + self.devices['voco'].properties['audio_output'].update( str(selection) ) + except Exception as ex: + print("Error setting new audio_output selection:" + str(ex)) - break + break - except Exception as ex: - print("Error in set_audio_output: " + str(ex)) + except Exception as ex: + print("Error in set_audio_output: " + str(ex))