Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added option for systemd-timesyncd #21

Merged
merged 12 commits into from
Feb 17, 2024
31 changes: 19 additions & 12 deletions ovos_PHAL_plugin_system/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from ovos_utils.gui import GUIInterface
from ovos_utils.process_utils import RuntimeRequirements
from ovos_utils.system import system_reboot, system_shutdown, ssh_enable,\
ssh_disable, ntp_sync, restart_service, is_process_running, \
check_service_active
ssh_disable, ntp_sync, timesync_sync, restart_service, is_process_running, \
check_service_active, check_service_installed
from ovos_utils.xdg_utils import xdg_state_home, xdg_cache_home, xdg_data_home
from ovos_utils.log import LOG

Expand Down Expand Up @@ -210,16 +210,23 @@ def handle_ssh_disable_request(self, message):
self.gui.show_page(page)

def handle_ntp_sync_request(self, message):
ntp_sync()
# NOTE: this one defaults to False
# it is usually part of other groups of actions that may
# provide their own UI
if message.data.get("display", False):
page = join(dirname(__file__), "ui", "Status.qml")
self.gui["status"] = "Enabled"
self.gui["label"] = "Clock updated"
self.gui.show_page(page)
self.bus.emit(message.reply('system.ntp.sync.complete'))
# Check to see what service is installed
if check_service_installed('ntp'):
ntp_sync()
elif check_service_installed('systemd-timesyncd')
timesync_sync()
JarbasAl marked this conversation as resolved.
Show resolved Hide resolved
if check_service_active('ntp') or check_service_active('systemd-timesyncd'):
# NOTE: this one defaults to False
# it is usually part of other groups of actions that may
# provide their own UI
if message.data.get("display", False):
page = join(dirname(__file__), "ui", "Status.qml")
self.gui["status"] = "Enabled"
self.gui["label"] = "Clock updated"
self.gui.show_page(page)
self.bus.emit(message.reply('system.ntp.sync.complete'))
else:
LOG.debug("No time sync service installed")

def handle_reboot_request(self, message):
if message.data.get("display", True):
Expand Down