Files
brewpi/components/aheater.py
T
2021-10-18 14:32:56 +02:00

52 lines
806 B
Python

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