Skip to content

Commit

Permalink
Added configuration validation
Browse files Browse the repository at this point in the history
version restraint for ovos-i2c-detection
  • Loading branch information
builderjer committed Jan 7, 2025
1 parent 57a9a8f commit 6cea6dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ovos_PHAL_plugin_mk1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

0 comments on commit 6cea6dd

Please sign in to comment.