led colors

This commit is contained in:
Devaev Maxim
2020-09-10 18:26:43 +03:00
parent 92ba157b67
commit bae65c35ee
2 changed files with 14 additions and 7 deletions

View File

@@ -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 {