Device.py
 1  from abc import ABC, abstractmethod
 2  
 3  class TemperatureController(ABC):
 4      """A superclass base class for all the temperature controllers and bridge"""
 5      
 6      def __init__(self, port, name):
 7          self.port = port
 8          self.name = name
 9          self.input_channels = []
10          
11          
12      @abstractmethod
13      def list_input_channels(self):
14          """Provide a list of all the input channels"""
15          raise NotImplementedError(
16              "Subclasses must Implement list_input_channels()")
17      
18      @abstractmethod
19      def get_temperature(self):
20          """Get a temperature read from a specific channel"""
21          raise NotImplementedError(
22              "Subclasses must Implement get_temperature()")
23      
24      @abstractmethod
25      def get_sensor(self):
26          """Get a sensor read from a specific channel"""
27          raise NotImplementedError("Subclasses must Implement get_sensor()")
28      
29      @abstractmethod
30      def read_all_channels_temperature(self):
31          """Get a temperature read from all the input channels"""
32          raise NotImplementedError(
33              "Subclasses must Implement read_all_channels_temperature()")
34      
35      @abstractmethod
36      def read_all_channels_sensor(self):
37          """Get a sensor read from all the input channels"""
38          raise NotImplementedError(
39              "Subclasses must Implement read_all_channels_sensor()")
40      
41      
42      
43  class HeaterController(ABC):
44      
45      def __init__(self, port, name):
46          super().__init__(port, name)
47          self.output_channels = []
48      
49      @abstractmethod
50      def list_output_channels(self):
51          raise NotImplementedError(
52              "Subclasses must Implement list_output_channels()")
53      
54      
55