Skip to content

Commit

Permalink
refactor/ovos-bus-client (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl authored Apr 11, 2023
1 parent cbb5b74 commit d43e4d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions ovos_PHAL/admin.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 = {}
Expand Down
17 changes: 8 additions & 9 deletions ovos_PHAL/service.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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)

Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit d43e4d0

Please sign in to comment.