From dd8e664b9ae0321732f4f78b33056f6d75302dab Mon Sep 17 00:00:00 2001 From: Candle - the privacy friendly smart home <39312291+createcandle@users.noreply.github.com> Date: Mon, 7 Mar 2022 15:49:20 +0100 Subject: [PATCH] Add files via upload --- manifest.json | 6 +++++- pkg/voco_adapter.py | 23 ++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index f9e776f3..38443db6 100644 --- a/manifest.json +++ b/manifest.json @@ -170,6 +170,10 @@ "description": "If this is a satellite, enabling this will allow you to control things on this satellite using your voice. It's recommended to give things on satellites unique names. For example, call 'radio' something like 'kitchen radio' instead. If a thing with the same name exists on the main controller and on a satellite, a voice command will always favour controlling the satellite's thing.", "type": "boolean" }, + "Disable security": { + "description": "Advanced. Disabling security might make Voco play nice with older/other versions of Candle or the Webthings Gateway.", + "type": "boolean" + }, "Debugging": { "description": "Advanced. Debugging allows you to diagnose any issues with the add-on. If enabled it will result in a lot more debug data in the internal log (which can be found under settings -> developer -> view internal logs).", "type": "boolean" @@ -184,7 +188,7 @@ } }, "short_name": "Voco", - "version": "2.8.4", + "version": "2.8.5", "web_accessible_resources": [ "css/*.css", "images/*.svg", diff --git a/pkg/voco_adapter.py b/pkg/voco_adapter.py index a6872fea..739d330c 100644 --- a/pkg/voco_adapter.py +++ b/pkg/voco_adapter.py @@ -297,7 +297,7 @@ def __init__(self, verbose=True): # MQTT client self.mqtt_client = None - self.mqtt_port = 1883 + self.mqtt_port = 1884 self.mqtt_connected = False self.voco_connected = True self.mqtt_others = {} @@ -307,6 +307,7 @@ def __init__(self, verbose=True): self.should_restart_mqtt = True self.mqtt_busy_connecting = False self.mqtt_connected_succesfully_at_least_once = False + self.disable_security = False # Things @@ -788,6 +789,20 @@ def add_from_config(self): if self.DEBUG: print("Debugging enabled") + + # Disable security + try: + if 'Disable security' in config: + self.disable_security = bool(config['Disable security']) + if self.disable_security: + self.mqtt_port = 1883 # might still be overridden by the user, but 1883 is now the default. + print("WARNING, VOCO SECURITY HAS BEEN DISABLED") + + + except Exception as ex: + print("Error loading disable security setting(s) from config: " + str(ex)) + + try: store_updated_settings = False if 'Microphone' in config: @@ -966,6 +981,10 @@ def add_from_config(self): except Exception as ex: print("Error loading voice setting(s) from config: " + str(ex)) + + + + @@ -2625,6 +2644,8 @@ def run_mqtt(self): self.mqtt_client.on_disconnect = self.on_disconnect self.mqtt_client.on_message = self.on_message self.mqtt_client.on_publish = self.on_publish + if self.disable_security == False: + self.mqtt_client.username_pw_set(username="candle", password="smarthome") if self.DEBUG: print("self.persistent_data['mqtt_server'] = " + str(self.persistent_data['mqtt_server']))