From 6cea6dd76a68ef9ff63694d0101d25b1ceee54cc Mon Sep 17 00:00:00 2001 From: builderjer Date: Tue, 7 Jan 2025 06:33:58 -0700 Subject: [PATCH] Added configuration validation version restraint for ovos-i2c-detection --- ovos_PHAL_plugin_mk1/__init__.py | 4 ++++ requirements.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ovos_PHAL_plugin_mk1/__init__.py b/ovos_PHAL_plugin_mk1/__init__.py index 40c33e5..39b3937 100644 --- a/ovos_PHAL_plugin_mk1/__init__.py +++ b/ovos_PHAL_plugin_mk1/__init__.py @@ -12,6 +12,7 @@ from ovos_utils.log import LOG from ovos_utils.network_utils import is_connected from ovos_i2c_detection import is_mark_1 +from ovos_config import Configuration from ovos_PHAL_plugin_mk1.arduino import EnclosureReader, EnclosureWriter @@ -31,6 +32,9 @@ def validate(config=None): """ this method is called before loading the plugin. If it returns False the plugin is not loaded. This allows a plugin to run platform checks""" + cfg = config or Configuration().get("PHAL").get("ovos-PHAL-plugin-mk1") + if cfg.get("enabled") == True: + return True if is_mark_1(): return True return False diff --git a/requirements.txt b/requirements.txt index 67b7b3c..7cc0b2a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ ovos-plugin-manager>=0.0.24 ovos-mark1-utils>=0.0.1 ovos-utils>=0.0.38 -ovos-i2c-detection +ovos-i2c-detection>=0.0.4 pyserial~=3.0