diff --git a/mycroft/api/__init__.py b/mycroft/api/__init__.py index 9a23025ae7..58fd0b0e61 100644 --- a/mycroft/api/__init__.py +++ b/mycroft/api/__init__.py @@ -71,7 +71,7 @@ class Api(object): data = self.get_data(response) if 200 <= response.status_code < 300: return data - elif response.status_code == 401\ + elif response.status_code == 401 \ and not response.url.endswith("auth/token"): self.refresh_token() return self.send(self.old_params) @@ -147,6 +147,15 @@ class DeviceApi(Api): "enclosureVersion": version.get("enclosureVersion")} }) + def update_version(self): + version = VersionManager.get() + return self.request({ + "method": "PATCH", + "path": "/" + self.identity.uuid, + "json": {"coreVersion": version.get("coreVersion"), + "enclosureVersion": version.get("enclosureVersion")} + }) + def get(self): """ Retrieve all device information from the web backend """ return self.request({ diff --git a/mycroft/configuration/mycroft.conf b/mycroft/configuration/mycroft.conf index 0fdab394ec..1d1ca0221d 100644 --- a/mycroft/configuration/mycroft.conf +++ b/mycroft/configuration/mycroft.conf @@ -107,7 +107,7 @@ "websocket": { "host": "0.0.0.0", "port": 8181, - "route": "/core", + "route": "/core" , "ssl": false }, diff --git a/mycroft/skills/main.py b/mycroft/skills/main.py index 710cc52840..4f0b04059a 100644 --- a/mycroft/skills/main.py +++ b/mycroft/skills/main.py @@ -169,6 +169,10 @@ def check_connection(): 'lang': "en-us" } ws.emit(Message("recognizer_loop:utterance", payload)) + else: + from mycroft.api import DeviceApi + api = DeviceApi() + api.update_version() else: thread = Timer(1, check_connection) thread.daemon = True