107 lines
2.1 KiB
Python
107 lines
2.1 KiB
Python
from app.auto.controller import AutoController
|
|
|
|
|
|
def main() -> None:
|
|
controller = object.__new__(
|
|
AutoController
|
|
)
|
|
|
|
controller._manual_heater_enabled = None
|
|
controller._manual_target_temperature = None
|
|
controller._manual_heating = None
|
|
|
|
print("Initial:")
|
|
print(
|
|
{
|
|
"enabled": controller._manual_heater_enabled,
|
|
"target_temp": controller._manual_target_temperature,
|
|
"heating": controller._manual_heating,
|
|
}
|
|
)
|
|
|
|
controller.set_manual_heater_enabled(
|
|
True
|
|
)
|
|
|
|
controller.set_manual_target_temperature(
|
|
23
|
|
)
|
|
|
|
print("After enable + target 23:")
|
|
print(
|
|
{
|
|
"enabled": controller.manual_heater_enabled,
|
|
"target_temp": controller.manual_target_temperature,
|
|
"heating": controller._manual_heating,
|
|
}
|
|
)
|
|
|
|
assert (
|
|
controller.manual_heater_enabled
|
|
is True
|
|
)
|
|
|
|
assert (
|
|
controller.manual_target_temperature
|
|
== 23
|
|
)
|
|
|
|
assert (
|
|
controller._manual_heating
|
|
is None
|
|
)
|
|
|
|
controller.set_manual_heater_enabled(
|
|
False
|
|
)
|
|
|
|
print("After heater OFF:")
|
|
print(
|
|
{
|
|
"enabled": controller.manual_heater_enabled,
|
|
"target_temp": controller.manual_target_temperature,
|
|
"heating": controller._manual_heating,
|
|
}
|
|
)
|
|
|
|
assert (
|
|
controller.manual_heater_enabled
|
|
is False
|
|
)
|
|
|
|
assert (
|
|
controller._manual_heating
|
|
is False
|
|
)
|
|
|
|
controller.clear_manual_heater_control()
|
|
|
|
print("After clear:")
|
|
print(
|
|
{
|
|
"enabled": controller.manual_heater_enabled,
|
|
"target_temp": controller.manual_target_temperature,
|
|
"heating": controller._manual_heating,
|
|
}
|
|
)
|
|
|
|
assert (
|
|
controller.manual_heater_enabled
|
|
is None
|
|
)
|
|
|
|
assert (
|
|
controller.manual_target_temperature
|
|
is None
|
|
)
|
|
|
|
assert (
|
|
controller._manual_heating
|
|
is None
|
|
)
|
|
|
|
print("TEST PASSED")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |