mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-12-24 14:34:59 +01:00
compatibility test to support compressoractor plugin
This commit is contained in:
parent
57572c777e
commit
822ed8df14
4 changed files with 15 additions and 3 deletions
|
@ -1,3 +1,3 @@
|
|||
__version__ = "4.4.1.a1"
|
||||
__version__ = "4.4.1.a2"
|
||||
__codename__ = "Yeast Starter"
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ class CBPiActor(metaclass=ABCMeta):
|
|||
self.state = False
|
||||
self.running = False
|
||||
self.power = 100
|
||||
self.timer = 0
|
||||
|
||||
def init(self):
|
||||
pass
|
||||
|
|
|
@ -56,13 +56,14 @@ class Actor:
|
|||
props: Props = Props()
|
||||
state: bool = False
|
||||
power: int = 100
|
||||
timer: int = 0
|
||||
type: str = None
|
||||
instance: str = None
|
||||
|
||||
def __str__(self):
|
||||
return "name={} props={}, state={}, type={}, power={}".format(self.name, self.props, self.state, self.type, self.power)
|
||||
return "name={} props={}, state={}, type={}, power={}, timer={}".format(self.name, self.props, self.state, self.type, self.power, self.timer)
|
||||
def to_dict(self):
|
||||
return dict(id=self.id, name=self.name, type=self.type, props=self.props.to_dict(), state=self.instance.get_state(), power=self.power)
|
||||
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)
|
||||
|
||||
class DataType(Enum):
|
||||
VALUE="value"
|
||||
|
|
|
@ -67,6 +67,16 @@ class ActorController(BasicController):
|
|||
except Exception as e:
|
||||
logging.error("Failed to update Actor {} {}".format(id, e))
|
||||
|
||||
async def timeractor_update(self, id, timer):
|
||||
try:
|
||||
item = self.find_by_id(id)
|
||||
item.timer = round(timer)
|
||||
#await self.push_udpate()
|
||||
self.cbpi.ws.send(dict(topic=self.update_key, data=list(map(lambda item: item.to_dict(), self.data))))
|
||||
self.cbpi.push_update("cbpi/actorupdate/{}".format(id), item.to_dict())
|
||||
except Exception as e:
|
||||
logging.error("Failed to update Actor {} {}".format(id, e))
|
||||
|
||||
async def ws_actor_update(self):
|
||||
try:
|
||||
#await self.push_udpate()
|
||||
|
|
Loading…
Reference in a new issue