mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-09 17:07:43 +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"
|
__codename__ = "Yeast Starter"
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ class CBPiActor(metaclass=ABCMeta):
|
||||||
self.state = False
|
self.state = False
|
||||||
self.running = False
|
self.running = False
|
||||||
self.power = 100
|
self.power = 100
|
||||||
|
self.timer = 0
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -56,13 +56,14 @@ class Actor:
|
||||||
props: Props = Props()
|
props: Props = Props()
|
||||||
state: bool = False
|
state: bool = False
|
||||||
power: int = 100
|
power: int = 100
|
||||||
|
timer: int = 0
|
||||||
type: str = None
|
type: str = None
|
||||||
instance: str = None
|
instance: str = None
|
||||||
|
|
||||||
def __str__(self):
|
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):
|
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):
|
class DataType(Enum):
|
||||||
VALUE="value"
|
VALUE="value"
|
||||||
|
|
|
@ -67,6 +67,16 @@ class ActorController(BasicController):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("Failed to update Actor {} {}".format(id, 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):
|
async def ws_actor_update(self):
|
||||||
try:
|
try:
|
||||||
#await self.push_udpate()
|
#await self.push_udpate()
|
||||||
|
|
Loading…
Reference in a new issue