smart_brain_test/smart_brain_test.py
2025-08-22 21:04:28 +02:00

62 lines
1.8 KiB
Python

import argparse
import config
import devdi.devices
import mqtt
from simulation.rooms import house
import report
import os
import time
import tests.help
# TODO: Extend tests in simulation
# - Compare with nodered capabilities
# - Add furthet heating checks (set to default, ...)
# - Test???: Check of warning messages for battery and overtemperature
# - Switching button functions (gfw_dirk, ffe.sleep)
# - Brightness button functions (gfw.dirk, ffe.sleep)
# - Remote actions after amplifier on
# - Heating functionality (extended: mode switch off by other function, timer)
# - Circulation pump (Extend Timer)
# - Stairways (Extend Motion sensor and Timer)
if __name__ == "__main__":
# Command line arguments
tcel = {
"single": report.TCEL_SINGLE,
"full": report.TCEL_FULL
}
parser = argparse.ArgumentParser()
parser.add_argument("level", help="Set the execution level", choices=tcel.keys(), default="full")
args = parser.parse_args()
#
# MQTT Client
#
mc = mqtt.mqtt_client(host=config.MQTT_SERVER, port=config.MQTT_PORT, username=config.MQTT_USER,
password=config.MQTT_PASSWORD, name=config.APP_NAME)
#
# Smarthome physical Devices
#
pd = devdi.devices.physical_devices(mc)
#
# House instance
#
h = house(mc, pd)
#
# Testsuite
#
ts = tests.help.testSession(mc, tcel=tcel.get(args.level))
# Add and run tests
tests.add_all_testcases(ts, mc, h)
# Export testresults
BASEPATH = os.path.abspath(os.path.join(os.path.dirname(__file__)))
ts.export_results_to(
template_file=os.path.join(BASEPATH, 'unittest', 'templates', 'unittest.tex'),
path=os.path.join(BASEPATH, "testresults")
)