added support for setting bus mode through dict

bus modes added to all 3 example configs.

config unit tests added
This commit is contained in:
onyx-and-iris
2022-07-16 21:19:10 +01:00
parent 695e3e4999
commit be2b89e3fa
5 changed files with 55 additions and 9 deletions

View File

@@ -27,9 +27,15 @@ class IRemote(metaclass=ABCMeta):
pass
def apply(self, data: dict) -> Self:
def fget(attr, val):
if attr == "mode":
return (getattr(self, attr), val, 1)
return (self, attr, val)
for attr, val in data.items():
if hasattr(self, attr):
setattr(self, attr, val)
target, attr, val = fget(attr, val)
setattr(target, attr, val)
return self
def then_wait(self):