Files
brewpi/components/aplant.py
T
jens 4e508c86c5 - redefine activate method
- for task introduced open() conext method
2020-12-18 15:58:02 +01:00

43 lines
660 B
Python

import abc
from utils.value import AttributeChange
from contextlib import contextmanager
class APlant(AttributeChange):
def __init__(self):
AttributeChange.__init__(self)
@contextmanager
def open(self):
try:
self.activate(True)
yield None
finally:
self.activate(False)
return None
@abc.abstractmethod
def activate(self, enable):
return None
@abc.abstractmethod
def is_activated(self):
return None
@abc.abstractmethod
def process(self):
pass
@abc.abstractmethod
def set_power(self, power):
pass
@abc.abstractmethod
def get_power(self):
return None
@abc.abstractmethod
def get_temperature(self):
return None