Skip to content

Commit

Permalink
Refactor to remove SJ201-interface dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Mar 29, 2024
1 parent b0c739d commit 2c13f28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 9 additions & 5 deletions neon_phal_plugin_switches/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,27 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from os.path import exists
from abc import ABC
from typing import Optional

from ovos_plugin_manager.phal import PHALPlugin
from ovos_plugin_manager.hardware.switches import AbstractSwitches
from ovos_utils.log import LOG
from ovos_bus_client.message import Message
from sj201_interface.revisions import detect_sj201_revision
from gpiozero import Button
from gpiozero import Button, pi_info, BadPinFactory


class SwitchValidator:
@staticmethod
def validate(_=None):
# TODO: More generic validation that GPIO exists
return detect_sj201_revision() is not None
try:
pi_info()
return True
except BadPinFactory:
return False
except Exception as e:
LOG.info(e)
return False


class SwitchInputs(PHALPlugin):
Expand Down
1 change: 0 additions & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
sj201-interface~=0.0.2
ovos-plugin-manager~=0.0.20
ovos-utils~=0.0.26
ovos-bus-client~=0.0.3
Expand Down

0 comments on commit 2c13f28

Please sign in to comment.