Added brightnes and color temperature tests

This commit is contained in:
Dirk Alders 2025-08-19 23:31:01 +02:00
parent 946ceead96
commit 226e9173cf
5 changed files with 111438 additions and 14477 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -5,7 +5,12 @@ from unittest.test import equivalency_chk
from .help import DELAY_SET_GET from .help import DELAY_SET_GET
def device_follow(tLogger, master, master_key, slave, slave_key, values): def device_follow(tLogger, master, master_key, slave, slave_key, values, switch_on):
# Prepare System
if switch_on is not None:
switch_on.set(switch_on.KEY_OUTPUT_0, True)
time.sleep(DELAY_SET_GET)
tLogger.debug("Prepare: Switching on device")
# Prepare devices to last state # Prepare devices to last state
start_state = values[-1] start_state = values[-1]
master.set(master_key, start_state) master.set(master_key, start_state)

View File

@ -14,6 +14,8 @@ from config import APP_NAME as ROOT_LOGGER_NAME
DELAY_SET_GET = 0.1 DELAY_SET_GET = 0.1
STATES_SW = (True, False) STATES_SW = (True, False)
STATES_BR = range(0, 101, 20)
STATES_CT = range(0, 11, 2)
class testSession(testSessionBase): class testSession(testSessionBase):

View File

@ -5,9 +5,12 @@ from mqtt import mqtt_client
from simulation.rooms import house from simulation.rooms import house
from .help import testSession from .help import testSession
from .help import STATES_SW from .help import STATES_SW, STATES_BR, STATES_CT
from tests.common_testcases import device_follow from tests.common_testcases import device_follow
# TODO: Add heating valve tests
# TODO: Compare with nodered capabilities and remove todos in code
def device_follow_sw(ts, testcase_id, master, slave, master_ch=0, slave_ch=0, single=False): def device_follow_sw(ts, testcase_id, master, slave, master_ch=0, slave_ch=0, single=False):
master_key = getattr(master, "KEY_OUTPUT_%d" % master_ch) master_key = getattr(master, "KEY_OUTPUT_%d" % master_ch)
@ -16,7 +19,25 @@ def device_follow_sw(ts, testcase_id, master, slave, master_ch=0, slave_ch=0, si
testcase_id, report.TCEL_SINGLE if single else report.TCEL_SMOKE, device_follow, testcase_id, report.TCEL_SINGLE if single else report.TCEL_SMOKE, device_follow,
master, master_key, master, master_key,
slave, slave_key, slave, slave_key,
STATES_SW STATES_SW, None
)
def device_follow_br(ts, testcase_id, master, slave, switch_on=None, single=False):
ts.testCase(
testcase_id, report.TCEL_SINGLE if single else report.TCEL_SMOKE, device_follow,
master, master.KEY_BRIGHTNESS,
slave, slave.KEY_BRIGHTNESS,
STATES_BR, switch_on
)
def device_follow_ct(ts, testcase_id, master, slave, switch_on=None, single=False):
ts.testCase(
testcase_id, report.TCEL_SINGLE if single else report.TCEL_SMOKE, device_follow,
master, master.KEY_COLOR_TEMP,
slave, slave.KEY_COLOR_TEMP,
STATES_CT, switch_on
) )
@ -38,6 +59,15 @@ def ffe(ts: testSession, mc: mqtt_client, h: house):
if config.CHRISTMAS: if config.CHRISTMAS:
device_follow_sw(ts, 'REQ-0006', room.videv_xmas_tree, room.xmas_tree) device_follow_sw(ts, 'REQ-0006', room.videv_xmas_tree, room.xmas_tree)
device_follow_sw(ts, 'REQ-0007', room.xmas_tree, room.videv_xmas_tree) device_follow_sw(ts, 'REQ-0007', room.xmas_tree, room.videv_xmas_tree)
# Brightness and Colortemperature ####################
device_follow_br(ts, 'REQ-0010', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_br(ts, 'REQ-0011', room.main_light_zigbee, room.videv_main_light, room.main_light)
device_follow_ct(ts, 'REQ-0012', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_ct(ts, 'REQ-0013', room.main_light_zigbee, room.videv_main_light, room.main_light)
device_follow_br(ts, 'REQ-0014', room.videv_floor_lamp, room.floor_lamp_zigbee, room.floor_lamp_zigbee)
device_follow_br(ts, 'REQ-0015', room.floor_lamp_zigbee, room.videv_floor_lamp, room.floor_lamp_zigbee)
device_follow_ct(ts, 'REQ-0016', room.videv_floor_lamp, room.floor_lamp_zigbee, room.floor_lamp_zigbee)
device_follow_ct(ts, 'REQ-0017', room.floor_lamp_zigbee, room.videv_floor_lamp, room.floor_lamp_zigbee)
# #
# ffe.sleep # ffe.sleep
@ -53,6 +83,14 @@ def ffe(ts: testSession, mc: mqtt_client, h: house):
# #
device_follow_sw(ts, 'REQ-0025', room.videv_bed_light_ma, room.bed_light_ma) device_follow_sw(ts, 'REQ-0025', room.videv_bed_light_ma, room.bed_light_ma)
device_follow_sw(ts, 'REQ-0026', room.bed_light_ma, room.videv_bed_light_ma) device_follow_sw(ts, 'REQ-0026', room.bed_light_ma, room.videv_bed_light_ma)
# Brightness and Colortemperature ####################
device_follow_br(ts, 'REQ-0027', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_br(ts, 'REQ-0028', room.main_light_zigbee, room.videv_main_light, room.main_light)
device_follow_ct(ts, 'REQ-0029', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_ct(ts, 'REQ-0030', room.main_light_zigbee, room.videv_main_light, room.main_light)
device_follow_br(ts, 'REQ-0031', room.videv_bed_light_di, room.bed_light_di_zigbee, room.bed_light_di_zigbee)
device_follow_br(ts, 'REQ-0032', room.bed_light_di_zigbee, room.videv_bed_light_di, room.bed_light_di_zigbee)
# TODO: Wardrobe
# #
# ffe.diningroom # ffe.diningroom
@ -82,6 +120,11 @@ def ffe(ts: testSession, mc: mqtt_client, h: house):
# circulation_pump # circulation_pump
device_follow_sw(ts, 'REQ-0063', room.videv_circulation_pump, room.circulation_pump) device_follow_sw(ts, 'REQ-0063', room.videv_circulation_pump, room.circulation_pump)
device_follow_sw(ts, 'REQ-0064', room.circulation_pump, room.videv_circulation_pump) device_follow_sw(ts, 'REQ-0064', room.circulation_pump, room.videv_circulation_pump)
# Brightness and Colortemperature ####################
# TODO: device_follow_br(ts, 'REQ-0070', room.videv_main_light, room.main_light_zigbee, room.main_light)
# TODO: device_follow_br(ts, 'REQ-0071', room.main_light_zigbee, room.videv_main_light, room.main_light)
# TODO: device_follow_ct(ts, 'REQ-0072', room.videv_main_light, room.main_light_zigbee, room.main_light)
# TODO: device_follow_ct(ts, 'REQ-0073', room.main_light_zigbee, room.videv_main_light, room.main_light)
# #
# ffe.floor # ffe.floor
@ -103,6 +146,11 @@ def ffw(ts: testSession, mc: mqtt_client, h: house):
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0101', room.videv_main_light, room.main_light) device_follow_sw(ts, 'REQ-0101', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0102', room.main_light, room.videv_main_light) device_follow_sw(ts, 'REQ-0102', room.main_light, room.videv_main_light)
# Brightness and Colortemperature ####################
device_follow_br(ts, 'REQ-0103', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_br(ts, 'REQ-0104', room.main_light_zigbee, room.videv_main_light, room.main_light)
device_follow_ct(ts, 'REQ-0105', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_ct(ts, 'REQ-0106', room.main_light_zigbee, room.videv_main_light, room.main_light)
# #
# ffw.sleep # ffw.sleep
@ -112,6 +160,10 @@ def ffw(ts: testSession, mc: mqtt_client, h: house):
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0121', room.videv_main_light, room.main_light) device_follow_sw(ts, 'REQ-0121', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0122', room.main_light, room.videv_main_light) device_follow_sw(ts, 'REQ-0122', room.main_light, room.videv_main_light)
# TODO: window_light
# Brightness and Colortemperature ####################
device_follow_br(ts, 'REQ-0123', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_br(ts, 'REQ-0124', room.main_light_zigbee, room.videv_main_light, room.main_light)
# #
# ffw.julian # ffw.julian
@ -121,6 +173,11 @@ def ffw(ts: testSession, mc: mqtt_client, h: house):
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0141', room.videv_main_light, room.main_light) device_follow_sw(ts, 'REQ-0141', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0142', room.main_light, room.videv_main_light) device_follow_sw(ts, 'REQ-0142', room.main_light, room.videv_main_light)
# Brightness and Colortemperature ####################
device_follow_br(ts, 'REQ-0143', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_br(ts, 'REQ-0144', room.main_light_zigbee, room.videv_main_light, room.main_light)
device_follow_ct(ts, 'REQ-0145', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_ct(ts, 'REQ-0146', room.main_light_zigbee, room.videv_main_light, room.main_light)
# #
# ffw.bath # ffw.bath
@ -178,6 +235,15 @@ def gfw(ts: testSession, mc: mqtt_client, h: house):
device_follow_sw(ts, 'REQ-0315', room.my_powerplug, room.my_powerplug, master_ch=1, slave_ch=0) device_follow_sw(ts, 'REQ-0315', room.my_powerplug, room.my_powerplug, master_ch=1, slave_ch=0)
device_follow_sw(ts, 'REQ-0316', room.my_powerplug, room.my_powerplug, master_ch=2, slave_ch=0) device_follow_sw(ts, 'REQ-0316', room.my_powerplug, room.my_powerplug, master_ch=2, slave_ch=0)
device_follow_sw(ts, 'REQ-0317', room.my_powerplug, room.my_powerplug, master_ch=3, slave_ch=0) device_follow_sw(ts, 'REQ-0317', room.my_powerplug, room.my_powerplug, master_ch=3, slave_ch=0)
# Brightness and Colortemperature ####################
device_follow_br(ts, 'REQ-0318', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_br(ts, 'REQ-0319', room.main_light_zigbee, room.videv_main_light, room.main_light)
device_follow_ct(ts, 'REQ-0320', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_ct(ts, 'REQ-0321', room.main_light_zigbee, room.videv_main_light, room.main_light)
device_follow_br(ts, 'REQ-0322', room.videv_desk_light, room.desk_light, room.desk_light)
device_follow_br(ts, 'REQ-0323', room.desk_light, room.videv_desk_light, room.desk_light)
device_follow_ct(ts, 'REQ-0324', room.videv_desk_light, room.desk_light, room.desk_light)
device_follow_ct(ts, 'REQ-0325', room.desk_light, room.videv_desk_light, room.desk_light)
# #
# gfw.marion # gfw.marion
@ -200,6 +266,11 @@ def gfw(ts: testSession, mc: mqtt_client, h: house):
# main_light videv<-->shelly # main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0361', room.videv_main_light, room.main_light) device_follow_sw(ts, 'REQ-0361', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0362', room.main_light, room.videv_main_light) device_follow_sw(ts, 'REQ-0362', room.main_light, room.videv_main_light)
# Brightness and Colortemperature ####################
device_follow_br(ts, 'REQ-0363', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_br(ts, 'REQ-0364', room.main_light_zigbee, room.videv_main_light, room.main_light)
device_follow_ct(ts, 'REQ-0365', room.videv_main_light, room.main_light_zigbee, room.main_light)
device_follow_ct(ts, 'REQ-0366', room.main_light_zigbee, room.videv_main_light, room.main_light)
def stw(ts: testSession, mc: mqtt_client, h: house): def stw(ts: testSession, mc: mqtt_client, h: house):