コード例 #1
0
def test_get_mode_set_mode():
    temp_controller = TemperatureController(20, 1, Mode.OFF)
    assert temp_controller.get_mode() == Mode.OFF
    temp_controller.set_mode(Mode.HEATER)
    assert temp_controller.get_mode() == Mode.HEATER
    temp_controller.set_mode(Mode.COOLER)
    assert temp_controller.get_mode() == Mode.COOLER
コード例 #2
0
def test_handle_new_reading_off():
    temp_controller = TemperatureController(20, 1, Mode.OFF)
    assert temp_controller.handle_new_reading(25) == State.ALL_OFF
    assert temp_controller.handle_new_reading(22) == State.ALL_OFF
    assert temp_controller.handle_new_reading(20.1) == State.ALL_OFF
    assert temp_controller.handle_new_reading(20) == State.ALL_OFF
    assert temp_controller.handle_new_reading(20.1) == State.ALL_OFF
    assert temp_controller.handle_new_reading(20.9) == State.ALL_OFF
    assert temp_controller.handle_new_reading(21) == State.ALL_OFF
    temp_controller.shutdown()
コード例 #3
0
def test_handle_new_reading_cooler():
    temp_controller = TemperatureController(20, 1, Mode.COOLER)
    assert temp_controller.handle_new_reading(25) == State.COOLER_ON
    assert temp_controller.handle_new_reading(22) == State.COOLER_ON
    assert temp_controller.handle_new_reading(20.1) == State.COOLER_ON
    assert temp_controller.handle_new_reading(20) == State.ALL_OFF
    assert temp_controller.handle_new_reading(20.1) == State.ALL_OFF
    assert temp_controller.handle_new_reading(20.9) == State.ALL_OFF
    assert temp_controller.handle_new_reading(21) == State.COOLER_ON
    temp_controller.shutdown()
コード例 #4
0
 def __init__(self, update_server):
     self.temperature_controller = TemperatureController(set_temperature=20,
                                                         mode=Mode.COOLER)
     self.sensor_controller = SensorController()
     self.mqtt_controller = DataController()
     self.user_interface = UserInterface()
     self.unit_controller = UnitController()
     self.update_server = update_server
     self.command_subscriber = CommandSubscriber("192.168.3.2",
                                                 self.handle_command)
     self.current_display_data = None
コード例 #5
0
def test_handle_new_reading_heater():
    temp_controller = TemperatureController(20, 1, Mode.HEATER)
    assert temp_controller.handle_new_reading(15) == State.HEATER_ON
    assert temp_controller.handle_new_reading(19) == State.HEATER_ON
    assert temp_controller.handle_new_reading(19.9) == State.HEATER_ON
    assert temp_controller.handle_new_reading(20.1) == State.ALL_OFF
    assert temp_controller.handle_new_reading(21) == State.ALL_OFF
    assert temp_controller.handle_new_reading(19.9) == State.ALL_OFF
    assert temp_controller.handle_new_reading(19.1) == State.ALL_OFF
    assert temp_controller.handle_new_reading(19.0) == State.HEATER_ON
    temp_controller.shutdown()
コード例 #6
0
def test_update_set_temperature():
    temp_controller = TemperatureController()
    interface = UserInterface(TemperatureUnits.C)
    interface.update_set_temperature(70, temp_controller)
コード例 #7
0
def test_get_set_temperature():
    temp_controller = TemperatureController(20, 1, Mode.OFF)
    assert temp_controller.get_set_temperature() == 20
コード例 #8
0
def test_update_set_temperature():
    temp_controller = TemperatureController(20, 1, Mode.OFF)
    assert temp_controller.update_set_temperature(25) == 25