adapt missing actor type in dataclass to other dataclasses

This commit is contained in:
avollkopf 2024-12-17 21:16:52 +01:00
parent aa55033cea
commit 47f5e82e77
2 changed files with 7 additions and 4 deletions

View file

@ -1,3 +1,3 @@
__version__ = "4.4.7.a2" __version__ = "4.4.7.a3"
__codename__ = "Yeast Starter" __codename__ = "Yeast Starter"

View file

@ -63,10 +63,13 @@ class Actor:
def __str__(self): def __str__(self):
return "name={} props={}, state={}, type={}, power={}, timer={}".format(self.name, self.props, self.state, self.type, self.power, self.timer) return "name={} props={}, state={}, type={}, power={}, timer={}".format(self.name, self.props, self.state, self.type, self.power, self.timer)
def to_dict(self): def to_dict(self):
if self.instance: if self.instance is not None:
return dict(id=self.id, name=self.name, type=self.type, props=self.props.to_dict(), state=self.instance.get_state(), power=self.power, timer=self.timer) state = self.instance.get_state()
type = self.type
else: else:
return dict(id=self.id, name=self.name, type="Not Available", props=self.props.to_dict(), state=False, power=0, timer=0) state = False
type = "!!! MISSING TYPE !!!"
return dict(id=self.id, name=self.name, type=type, props=self.props.to_dict(), state=state, power=self.power, timer=self.timer)
class DataType(Enum): class DataType(Enum):
VALUE="value" VALUE="value"