Testcases extended

This commit is contained in:
Dirk Alders 2025-09-02 20:26:06 +02:00
parent f5e747f428
commit 22fd8b53da
6 changed files with 71 additions and 25 deletions

View File

@ -1,7 +1,6 @@
OUTDIR=testresults OUTDIR=testresults
TEXFILE=$(OUTDIR)/testrun.tex TEXFILE=$(OUTDIR)/testrun.tex
PDFFILE=$(OUTDIR)/testrun.pdf PDFFILE=$(OUTDIR)/testrun.pdf
TEXFILE_FULL=$(OUTDIR)/testrun_full.tex
release: release:
cp -v $(PDFFILE) ../smart_brain/_testresults_ cp -v $(PDFFILE) ../smart_brain/_testresults_
@ -46,7 +45,6 @@ view_full:
localclean: localclean:
@latexmk -quiet -output-directory=$(OUTDIR) -c $(TEXFILE) > /dev/null @latexmk -quiet -output-directory=$(OUTDIR) -c $(TEXFILE) > /dev/null
@latexmk -quiet -output-directory=$(OUTDIR) -c $(TEXFILE_FULL) > /dev/null
@find . -name *~ -type f | xargs rm -f @find . -name *~ -type f | xargs rm -f
@find . -name __pycache__ -type d | xargs rm -rf @find . -name __pycache__ -type d | xargs rm -rf

View File

@ -18,11 +18,6 @@ logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
# TODO: Not yet implemented devices ################################### # TODO: Not yet implemented devices ###################################
def hue_sw_br_ct(mqtt_client, topic):
logger.warning("Device type hue_sw_br_ct is not yet implemented. Topic %s will not be supported", topic)
return None
def shelly_pro3(mqtt_client, topic): def shelly_pro3(mqtt_client, topic):
logger.warning("Device type shelly_pro3 is not yet implemented. Topic %s will not be supported", topic) logger.warning("Device type shelly_pro3 is not yet implemented. Topic %s will not be supported", topic)
return None return None
@ -168,6 +163,11 @@ class livarno_sw_br_ct(tradfri_light):
super().__init__(mqtt_client, topic, enable_state=True, enable_brightness=True, enable_color_temp=True, send_on_power_on=False) super().__init__(mqtt_client, topic, enable_state=True, enable_brightness=True, enable_color_temp=True, send_on_power_on=False)
class hue_sw_br_ct(tradfri_light):
def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, enable_state=True, enable_brightness=True, enable_color_temp=True, send_on_power_on=False)
class videv_sw(videv_light): class videv_sw(videv_light):
def __init__(self, mqtt_client, topic): def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, True, False, False, False) super().__init__(mqtt_client, topic, True, False, False, False)

View File

@ -12,6 +12,14 @@ class ffe_livingroom(rooms.ffe_livingroom):
self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, False, self.light_main_light.power_off) self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, False, self.light_main_light.power_off)
class ffe_kitchen(rooms.ffe_kitchen):
def __init__(self, mqtt_client):
super().__init__(mqtt_client)
# Enable/disable hue device, on power on/off
self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, True, self.light_main_light.power_on)
self.switch_main_light.add_callback(self.switch_main_light.KEY_OUTPUT_0, False, self.light_main_light.power_off)
class ffe_sleep(rooms.ffe_sleep): class ffe_sleep(rooms.ffe_sleep):
def __init__(self, mqtt_client): def __init__(self, mqtt_client):
super().__init__(mqtt_client) super().__init__(mqtt_client)
@ -67,7 +75,7 @@ class ffe(object):
def __init__(self, mqtt_client): def __init__(self, mqtt_client):
self.diningroom = rooms.ffe_diningroom(mqtt_client) self.diningroom = rooms.ffe_diningroom(mqtt_client)
self.floor = rooms.ffe_floor(mqtt_client) self.floor = rooms.ffe_floor(mqtt_client)
self.kitchen = rooms.ffe_kitchen(mqtt_client) self.kitchen = ffe_kitchen(mqtt_client)
self.livingroom = ffe_livingroom(mqtt_client) self.livingroom = ffe_livingroom(mqtt_client)
self.sleep = ffe_sleep(mqtt_client) self.sleep = ffe_sleep(mqtt_client)
@ -81,6 +89,11 @@ class ffw(object):
self.sleep = ffw_sleep(mqtt_client) self.sleep = ffw_sleep(mqtt_client)
class gar(object):
def __init__(self, mqtt_client):
self.garden = rooms.gar_garden(mqtt_client)
class gfw(object): class gfw(object):
def __init__(self, mqtt_client): def __init__(self, mqtt_client):
self.dirk = gfw_dirk(mqtt_client) self.dirk = gfw_dirk(mqtt_client)
@ -88,9 +101,15 @@ class gfw(object):
self.marion = rooms.gfw_marion(mqtt_client) self.marion = rooms.gfw_marion(mqtt_client)
class stw(object):
def __init__(self, mqtt_client):
self.stairway = rooms.stairway(mqtt_client)
class house(object): class house(object):
def __init__(self, mqtt_client): def __init__(self, mqtt_client):
self.ffe = ffe(mqtt_client) self.ffe = ffe(mqtt_client)
self.ffw = ffw(mqtt_client) self.ffw = ffw(mqtt_client)
self.gar = gar(mqtt_client)
self.gfw = gfw(mqtt_client) self.gfw = gfw(mqtt_client)
self.stairway = rooms.stairway(mqtt_client) self.stw = stw(mqtt_client)

View File

@ -12,8 +12,7 @@ import time
import tests.help import tests.help
# TODO: Extend tests in simulation # TODO: Extend tests
# - Compare with nodered capabilities + add garden
# - Complete inter room functions # - Complete inter room functions
# - cleanup (e.g. bedlight dirk, christmas star, ...) # - cleanup (e.g. bedlight dirk, christmas star, ...)
# - All off # - All off

View File

@ -1,4 +1,4 @@
from .rooms import preconditions, ffe, ffw, gfe, gfw, stw, inter_room from .rooms import preconditions, ffe, ffw, gar, gfe, gfw, stw, inter_room
# TODO: Coverage, *Information (Chapter 1), ... ausblenden, wenn leer # TODO: Coverage, *Information (Chapter 1), ... ausblenden, wenn leer
@ -7,8 +7,8 @@ def add_all_testcases(ts, mc, h):
preconditions(ts, mc, h) preconditions(ts, mc, h)
ffe(ts, mc, h) ffe(ts, mc, h)
ffw(ts, mc, h) ffw(ts, mc, h)
gar(ts, mc, h)
gfe(ts, mc, h) gfe(ts, mc, h)
gfw(ts, mc, h) gfw(ts, mc, h)
stw(ts, mc, h) stw(ts, mc, h)
inter_room(ts, mc, h) inter_room(ts, mc, h)
# TODO: GARDEN

View File

@ -71,7 +71,7 @@ def device_follow_temp(ts, master, slave, single=False):
) )
def device_flash_by_vers(ts, flash_device, trigger_device, start_state, trigger_vers, single=True): def device_flash_by_vers(ts, flash_device, trigger_device, start_state, trigger_vers, single=False):
flash_device_flash_key = flash_device.KEY_OUTPUT_0 flash_device_flash_key = flash_device.KEY_OUTPUT_0
if trigger_vers == FLASH_TRIGGER_LONGPUSH: if trigger_vers == FLASH_TRIGGER_LONGPUSH:
trigger_device_key = trigger_device.KEY_LONGPUSH_0 trigger_device_key = trigger_device.KEY_LONGPUSH_0
@ -140,9 +140,12 @@ def ffe(ts: testSession, mc: mqtt_client, h: house):
# bed_light_di videv<-->zigbee # bed_light_di videv<-->zigbee
device_follow_sw(ts, room.videv_bed_dirk_light, room.light_bed_dirk_light) device_follow_sw(ts, room.videv_bed_dirk_light, room.light_bed_dirk_light)
device_follow_sw(ts, room.light_bed_dirk_light, room.videv_bed_dirk_light) device_follow_sw(ts, room.light_bed_dirk_light, room.videv_bed_dirk_light)
# # bed_light_ma videv<-->zigbee
device_follow_sw(ts, room.videv_bed_marion_light, room.switch_bed_marion_light) device_follow_sw(ts, room.videv_bed_marion_light, room.switch_bed_marion_light)
device_follow_sw(ts, room.switch_bed_marion_light, room.videv_bed_marion_light) device_follow_sw(ts, room.switch_bed_marion_light, room.videv_bed_marion_light)
# wardrobe videv<-->zigbee
device_follow_sw(ts, room.videv_wardrobe_light, room.light_wardrobe_light)
device_follow_sw(ts, room.light_wardrobe_light, room.videv_wardrobe_light)
# Brightness and Colortemperature #################### # Brightness and Colortemperature ####################
device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light) device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light) device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
@ -150,7 +153,9 @@ def ffe(ts: testSession, mc: mqtt_client, h: house):
device_follow_ct(ts, room.light_main_light, room.videv_main_light, room.switch_main_light) device_follow_ct(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
device_follow_br(ts, room.videv_bed_dirk_light, room.light_bed_dirk_light, room.light_bed_dirk_light) device_follow_br(ts, room.videv_bed_dirk_light, room.light_bed_dirk_light, room.light_bed_dirk_light)
device_follow_br(ts, room.light_bed_dirk_light, room.videv_bed_dirk_light, room.light_bed_dirk_light) device_follow_br(ts, room.light_bed_dirk_light, room.videv_bed_dirk_light, room.light_bed_dirk_light)
# TODO: Wardrobe device_follow_br(ts, room.videv_wardrobe_light, room.light_wardrobe_light, room.light_wardrobe_light)
device_follow_br(ts, room.light_wardrobe_light, room.videv_wardrobe_light, room.light_wardrobe_light)
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.valve_heating) device_follow_temp(ts, room.videv_heating, room.valve_heating)
@ -183,13 +188,13 @@ def ffe(ts: testSession, mc: mqtt_client, h: house):
device_follow_sw(ts, room.videv_circulation_pump, room.switch_circulation_pump) device_follow_sw(ts, room.videv_circulation_pump, room.switch_circulation_pump)
device_follow_sw(ts, room.switch_circulation_pump, room.videv_circulation_pump) device_follow_sw(ts, room.switch_circulation_pump, room.videv_circulation_pump)
# circulation pump feedback (flash test) # circulation pump feedback (flash test)
device_flash_by_vers(ts, room.switch_main_light, room.switch_circulation_pump, True, FLASH_TRIGGER_ACTIVATE, single=True) device_flash_by_vers(ts, room.switch_main_light, room.switch_circulation_pump, True, FLASH_TRIGGER_ACTIVATE)
device_flash_by_vers(ts, room.switch_main_light, room.switch_circulation_pump, False, FLASH_TRIGGER_ACTIVATE, single=True) device_flash_by_vers(ts, room.switch_main_light, room.switch_circulation_pump, False, FLASH_TRIGGER_ACTIVATE)
# Brightness and Colortemperature #################### # Brightness and Colortemperature ####################
# TODO: device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light) device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
# TODO: device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light) device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
# TODO: device_follow_ct(ts, room.videv_main_light, room.light_main_light, room.switch_main_light) device_follow_ct(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
# TODO: device_follow_ct(ts, room.light_main_light, room.videv_main_light, room.switch_main_light) device_follow_ct(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.valve_heating) device_follow_temp(ts, room.videv_heating, room.valve_heating)
@ -231,10 +236,17 @@ def ffw(ts: testSession, mc: mqtt_client, h: house):
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.switch_main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
device_follow_sw(ts, room.switch_main_light, room.videv_main_light) device_follow_sw(ts, room.switch_main_light, room.videv_main_light)
# TODO: window_light device_follow_sw(ts, room.videv_window_light, room.light_window_light)
device_follow_sw(ts, room.light_window_light, room.videv_window_light)
device_follow_sw(ts, room.switch_main_light, room.light_window_light)
# Brightness and Colortemperature #################### # Brightness and Colortemperature ####################
device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light) device_follow_br(ts, room.videv_main_light, room.light_main_light, room.switch_main_light)
device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light) device_follow_br(ts, room.light_main_light, room.videv_main_light, room.switch_main_light)
device_follow_br(ts, room.videv_window_light, room.light_window_light, room.light_window_light)
device_follow_br(ts, room.light_window_light, room.videv_window_light, room.light_window_light)
device_follow_ct(ts, room.videv_window_light, room.light_window_light, room.light_window_light)
device_follow_ct(ts, room.light_window_light, room.videv_window_light, room.light_window_light)
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.valve_heating) device_follow_temp(ts, room.videv_heating, room.valve_heating)
@ -278,6 +290,19 @@ def ffw(ts: testSession, mc: mqtt_client, h: house):
device_flash_by_vers(ts, room.switch_main_light, room.switch_main_light, False, FLASH_TRIGGER_LONGPUSH) device_flash_by_vers(ts, room.switch_main_light, room.switch_main_light, False, FLASH_TRIGGER_LONGPUSH)
def gar(ts: testSession, mc: mqtt_client, h: house):
#
# ffw.livingroom
#
room = h.gar.garden
# Switching devices ##################################
# main_light videv<-->shelly
device_follow_sw(ts, room.videv_garland_light, room.switch_garland_light)
device_follow_sw(ts, room.switch_garland_light, room.videv_garland_light)
device_follow_sw(ts, room.videv_repeater, room.switch_repeater)
device_follow_sw(ts, room.switch_repeater, room.videv_repeater)
def gfe(ts: testSession, mc: mqtt_client, h: house): def gfe(ts: testSession, mc: mqtt_client, h: house):
# #
# gfe. # gfe.
@ -339,6 +364,11 @@ def gfw(ts: testSession, mc: mqtt_client, h: house):
device_follow_sw(ts, room.videv_window_light, room.light_window_light) device_follow_sw(ts, room.videv_window_light, room.light_window_light)
device_follow_sw(ts, room.light_window_light, room.videv_window_light) device_follow_sw(ts, room.light_window_light, room.videv_window_light)
device_follow_sw(ts, room.switch_main_light, room.light_window_light) device_follow_sw(ts, room.switch_main_light, room.light_window_light)
# Brightness and Colortemperature ####################
device_follow_br(ts, room.videv_window_light, room.light_window_light, room.light_window_light)
device_follow_br(ts, room.light_window_light, room.videv_window_light, room.light_window_light)
device_follow_ct(ts, room.videv_window_light, room.light_window_light, room.light_window_light)
device_follow_ct(ts, room.light_window_light, room.videv_window_light, room.light_window_light)
# Temperature ######################################## # Temperature ########################################
device_follow_temp(ts, room.videv_heating, room.valve_heating) device_follow_temp(ts, room.videv_heating, room.valve_heating)
@ -361,7 +391,7 @@ def stw(ts: testSession, mc: mqtt_client, h: house):
# #
# stairways # stairways
# #
room = h.stairway room = h.stw.stairway
# Switching devices ################################## # Switching devices ##################################
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, room.videv_main_light, room.switch_main_light) device_follow_sw(ts, room.videv_main_light, room.switch_main_light)
@ -373,7 +403,7 @@ def stw(ts: testSession, mc: mqtt_client, h: house):
def inter_room(ts: testSession, mc: mqtt_client, h: house): def inter_room(ts: testSession, mc: mqtt_client, h: house):
# #
# gfw.dirk.swith # gfw.dirk.swith -> ffw.floor.switch
# #
input = h.gfw.dirk.switch_main_light input = h.gfw.dirk.switch_main_light
output = h.gfw.floor.switch_main_light output = h.gfw.floor.switch_main_light