summaryrefslogtreecommitdiff
path: root/kvmd
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-09-08 06:30:13 +0300
committerDevaev Maxim <[email protected]>2020-09-08 06:30:13 +0300
commit4767a44af86fc956e8c48d854855c35db63d61e9 (patch)
treea6d87f6194dd911b8e7b089175b4d15d3f872dc5 /kvmd
parent71aa087b3ebccbaf91e96ce24aac1bc6a3a3484a (diff)
improved ugpio scheme api
Diffstat (limited to 'kvmd')
-rw-r--r--kvmd/apps/kvmd/ugpio.py9
-rw-r--r--kvmd/plugins/ugpio/__init__.py3
2 files changed, 10 insertions, 2 deletions
diff --git a/kvmd/apps/kvmd/ugpio.py b/kvmd/apps/kvmd/ugpio.py
index ab034365..b678cd0b 100644
--- a/kvmd/apps/kvmd/ugpio.py
+++ b/kvmd/apps/kvmd/ugpio.py
@@ -81,7 +81,12 @@ class _GpioInput:
self.__driver.register_input(self.__pin)
def get_scheme(self) -> Dict:
- return {}
+ return {
+ "hw": {
+ "driver": self.__driver.get_instance_id(),
+ "pin": self.__pin,
+ },
+ }
def get_state(self) -> Dict:
(online, state) = (True, False)
@@ -136,7 +141,7 @@ class _GpioOutput: # pylint: disable=too-many-instance-attributes
"max_delay": (self.__max_pulse_delay if self.__pulse_delay else 0),
},
"hw": {
- "driver": str(self.__driver),
+ "driver": self.__driver.get_instance_id(),
"pin": self.__pin,
},
}
diff --git a/kvmd/plugins/ugpio/__init__.py b/kvmd/plugins/ugpio/__init__.py
index 0cc8662a..96195d30 100644
--- a/kvmd/plugins/ugpio/__init__.py
+++ b/kvmd/plugins/ugpio/__init__.py
@@ -58,6 +58,9 @@ class BaseUserGpioDriver(BasePlugin):
self._instance_name = instance_name
self._notifier = notifier
+ def get_instance_id(self) -> str:
+ return self._instance_name
+
def register_input(self, pin: int) -> None:
raise NotImplementedError