From d43e4d0fa0bb6f041becac556b8785095096c866 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Tue, 11 Apr 2023 23:53:14 +0100 Subject: [PATCH] refactor/ovos-bus-client (#17) --- ovos_PHAL/admin.py | 4 ++-- ovos_PHAL/service.py | 17 ++++++++--------- requirements/requirements.txt | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ovos_PHAL/admin.py b/ovos_PHAL/admin.py index 589cf7f..bc6ddbe 100644 --- a/ovos_PHAL/admin.py +++ b/ovos_PHAL/admin.py @@ -1,6 +1,6 @@ from ovos_plugin_manager.phal import find_admin_plugins from ovos_utils import wait_for_exit_signal -from ovos_utils.configuration import read_mycroft_config +from ovos_config import Configuration from ovos_utils.log import LOG from ovos_PHAL import PHAL @@ -40,7 +40,7 @@ def __init__(self, config=None, bus=None, on_ready=on_admin_ready, on_error=on_a watchdog=lambda: None, name="PHAL.admin", **kwargs): if not config: try: - config = read_mycroft_config() + config = Configuration() config = config.get("PHAL", {}).get("admin", {}) except: config = {} diff --git a/ovos_PHAL/service.py b/ovos_PHAL/service.py index 1e68e1a..2582880 100644 --- a/ovos_PHAL/service.py +++ b/ovos_PHAL/service.py @@ -1,7 +1,7 @@ from ovos_plugin_manager.phal import find_phal_plugins -from ovos_utils.configuration import read_mycroft_config +from ovos_config import Configuration from ovos_utils.log import LOG -from ovos_utils.messagebus import get_mycroft_bus +from ovos_bus_client.client import MessageBusClient from ovos_utils.process_utils import ProcessStatus, StatusCallbackMap from ovos_workshop import OVOSAbstractApplication @@ -52,13 +52,11 @@ def __init__(self, config=None, bus=None, on_started=started_hook) self.status = ProcessStatus(name, callback_map=callbacks) self._watchdog = watchdog # TODO implement - if not config: - try: - config = read_mycroft_config()["PHAL"] - except: - config = {} - self.config = config - self.bus = bus or get_mycroft_bus() + self.config = config or Configuration().get("PHAL") or {} + if not bus: + bus = MessageBusClient() + bus.run_in_thread() + self.bus = bus self.drivers = {} self.status.bind(self.bus) @@ -83,6 +81,7 @@ def start(self): self.load_plugins() self.status.set_ready() except Exception as e: + LOG.exception(e) self.status.set_error(e) def shutdown(self): diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 4bce3e9..afe80d8 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,5 +1,5 @@ ovos-utils~=0.0, >=0.0.31a6 -ovos-bus-client~=0.0, >=0.0.3a10 +ovos-bus-client>=0.0.3a16,~=0.0 ovos_workshop~=0.0, >=0.0.12a3 ovos-config~=0.0,>=0.0.8a3 ovos-plugin-manager~=0.0, >=0.0.23a5