mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2026-04-18 21:13:30 +00:00
BusModes IntEnum added to bus
get() added to bus mode mixin, returns the current bus mode. added support for setting bus mode by dict fixed bug in apply where bool parameters weren't being applied. bus modes added to all 3 example configs. test_config added to unit tests.
This commit is contained in:
@@ -107,9 +107,19 @@ class IRemote(metaclass=ABCMeta):
|
||||
|
||||
def apply(self, data):
|
||||
"""Sets all parameters of a dict for the channel."""
|
||||
script = ""
|
||||
|
||||
def fget(attr, val):
|
||||
if attr == "mode":
|
||||
return (f"mode.{val}", 1)
|
||||
return (attr, val)
|
||||
|
||||
script = str()
|
||||
for attr, val in data.items():
|
||||
if hasattr(self, attr):
|
||||
attr, val = fget(attr, val)
|
||||
if isinstance(val, bool):
|
||||
val = 1 if val else 0
|
||||
|
||||
self._remote.cache[f"{self.identifier}[{self.index}].{attr}"] = val
|
||||
script += f"{self.identifier}[{self.index}].{attr}={val};"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user