summaryrefslogtreecommitdiff
path: root/kvmd
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-09-10 18:26:43 +0300
committerDevaev Maxim <[email protected]>2020-09-10 18:26:43 +0300
commitbae65c35ee9db3dfd478fb60ce20cdf6d3a2e57b (patch)
tree2133203e4fea515f82213cb33310f306573ab3ad /kvmd
parent92ba157b6758d26d21c512c6ad166f86d8b5f00d (diff)
led colors
Diffstat (limited to 'kvmd')
-rw-r--r--kvmd/apps/kvmd/ugpio.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/kvmd/apps/kvmd/ugpio.py b/kvmd/apps/kvmd/ugpio.py
index e6723b3e..f2ff2b1b 100644
--- a/kvmd/apps/kvmd/ugpio.py
+++ b/kvmd/apps/kvmd/ugpio.py
@@ -330,16 +330,19 @@ class UserGpio:
else:
parts = list(map(str.strip, item.split("|", 1)))
if parts:
- if parts[0] in self.__inputs:
+ channel: str = parts[0]
+ param: Optional[str] = (parts[1] if len(parts) > 1 else None)
+ if channel in self.__inputs:
items.append({
"type": UserGpioModes.INPUT,
- "channel": parts[0],
+ "channel": channel,
+ "color": (param if param in ["green", "yellow", "red"] else "green"),
})
- elif parts[0] in self.__outputs:
+ elif channel in self.__outputs:
items.append({
"type": UserGpioModes.OUTPUT,
"channel": parts[0],
- "text": (parts[1] if len(parts) > 1 else "Click"),
+ "text": (param if param is not None else "Click"),
})
table.append(items)
return {