Added all sw tests for smarthome

This commit is contained in:
Dirk Alders 2025-08-19 21:10:30 +02:00
parent 9234cf7561
commit b6433c4da8
6 changed files with 233 additions and 115 deletions

2
devdi

@ -1 +1 @@
Subproject commit 619d7f926f13ce03950db9c5dab3461e5b7da23a
Subproject commit 6813ec40fe716cfc5bdab827769f8d88bfbc860e

View File

@ -3,6 +3,16 @@ from simulation.devices import tradfri_light
from simulation.devices import silvercrest_powerplug
from simulation.devices import shelly as shelly_sw1
from simulation.devices import brennenstuhl_heatingvalve
from simulation.devices import my_powerplug
shelly_pro3 = None
tradfri_button = None
hue_sw_br_ct = None
silvercrest_button = None
silvercrest_motion_sensor = None
audio_status = None
remote = None
my_ambient = None
class tradfri_sw(tradfri_light):
@ -25,17 +35,6 @@ 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)
my_powerplug = None
shelly_pro3 = None
tradfri_button = None
hue_sw_br_ct = None
silvercrest_button = None
silvercrest_motion_sensor = None
audio_status = None
remote = None
my_ambient = None
class group(object):
def __init__(self, *args):
super().__init__()

View File

@ -31,9 +31,6 @@ class base_common(mqtt_base):
def add_channel_name(self, key, name):
self.names[key] = name
def capabilities(self):
return self.commands
def __payload_filter__(self, payload):
try:
return json.loads(payload)
@ -298,30 +295,45 @@ class shelly(base):
class my_powerplug(base):
KEY_OUTPUT_0 = "state"
KEY_OUTPUT_0 = "output/1"
KEY_OUTPUT_1 = "output/2"
KEY_OUTPUT_2 = "output/3"
KEY_OUTPUT_3 = "output/4"
#
BOOL_KEYS = [KEY_OUTPUT_0, KEY_OUTPUT_1, KEY_OUTPUT_2, KEY_OUTPUT_3, ]
#
COMMANDS = [
"get_output", "toggle_output",
]
def __init__(self, mqtt_client, topic, channel):
super().__init__(mqtt_client, topic + '/' + "output/%d" % (channel + 1), default_values={self.KEY_OUTPUT_0: False})
#
def __init__(self, mqtt_client, topic):
super().__init__(mqtt_client, topic, default_values={self.KEY_OUTPUT_0: False, self.KEY_OUTPUT_1: False,
self.KEY_OUTPUT_2: False, self.KEY_OUTPUT_3: False, })
# print ouput changes
self.add_callback(self.KEY_OUTPUT_0, None, self.print_formatted, True)
self.add_callback(self.KEY_OUTPUT_1, None, self.print_formatted, True)
self.add_callback(self.KEY_OUTPUT_2, None, self.print_formatted, True)
self.add_callback(self.KEY_OUTPUT_3, None, self.print_formatted, True)
# publish state changes
self.add_callback(self.KEY_OUTPUT_0, None, self.__send__, True)
self.add_callback(self.KEY_OUTPUT_1, None, self.__send__, True)
self.add_callback(self.KEY_OUTPUT_2, None, self.__send__, True)
self.add_callback(self.KEY_OUTPUT_3, None, self.__send__, True)
#
self.__tx__((self.KEY_OUTPUT_0, ))
self.__tx__((self.KEY_OUTPUT_1, ))
self.__tx__((self.KEY_OUTPUT_2, ))
self.__tx__((self.KEY_OUTPUT_3, ))
def __rx__(self, client, userdata, message):
if message.topic == self.topic + '/set':
payload = self.__payload_filter__(message.payload)
if payload == "toggle":
payload = not self.get(self.KEY_OUTPUT_0)
self.set(self.KEY_OUTPUT_0, payload)
value = self.__payload_filter__(message.payload)
if message.topic.startswith(self.topic) and message.topic.endswith("/set"):
key = '/'.join(message.topic.split('/')[-3:-1])
self.set(key, value)
def __tx__(self, keys_changed):
for key in keys_changed:
self.mqtt_client.send(self.topic, json.dumps(self.get(key)))
self.mqtt_client.send(self.topic + "/" + key, json.dumps(self.get(key)))
def command(self, command):
if command in self.COMMANDS:

View File

@ -3,6 +3,8 @@ from simulation.devices import videv_light, videv_heating, videv_warnings
import inspect
from devdi import topic as props
# TODO: Add channel names for all devices in devdi! Move it from here to devdi. Adaption in other prjs required!
class base(object):
def getmembers(self, prefix=''):
@ -60,12 +62,15 @@ class gfw_marion(base):
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light")
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light (gfw.marion)")
self.window_light = pd.get(props.STG_ZGW, loc, roo, props.FUN_WIL)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Window Light (gfw.marion)")
self.heating_valve = pd.get(props.STG_ZGW, loc, roo, props.FUN_HEA)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_GFW_MARION_MAIN_LIGHT_VIDEV, True, False, False)
self.videv_window_light = videv_light(mqtt_client, config.TOPIC_GFW_MARION_WINDOW_LAMP_VIDEV, True, False, False)
self.videv_heating = videv_heating(mqtt_client, config.TOPIC_GFW_MARION_HEATING_VALVE_VIDEV)
@ -76,33 +81,32 @@ class gfw_dirk(base):
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light")
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light (gfw.dirk)")
self.main_light_zigbee = pd.get(props.STG_ZGW, loc, roo, props.FUN_MAL)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off)
self.desk_light = pd.get(props.STG_ZGW, loc, roo, props.FUN_DEL)
self.desk_light.add_channel_name(self.desk_light.KEY_OUTPUT_0, "Desk Light (gfw.dirk)")
self.pc_dock = pd.get(props.STG_ZGW, loc, roo, props.FUN_DCK)
# TODO: Add this again...
# self.amplifier = my_powerplug(mqtt_client, config.TOPIC_GFW_DIRK_POWERPLUG, 0)
# self.amplifier.add_channel_name(self.amplifier.KEY_OUTPUT_0, "Amplifier")
# self.desk_light = my_powerplug(mqtt_client, config.TOPIC_GFW_DIRK_POWERPLUG, 1)
# self.desk_light.add_channel_name(self.desk_light.KEY_OUTPUT_0, "Desk Light")
# self.cd_player = my_powerplug(mqtt_client, config.TOPIC_GFW_DIRK_POWERPLUG, 2)
# self.cd_player.add_channel_name(self.cd_player.KEY_OUTPUT_0, "CD_Player")
# self.pc_dock = my_powerplug(mqtt_client, config.TOPIC_GFW_DIRK_POWERPLUG, 3)
# self.pc_dock.add_channel_name(self.pc_dock.KEY_OUTPUT_0, "PC_Dock")
# self.desk_light_zigbee = tradfri_light(mqtt_client, config.TOPIC_GFW_DIRK_DESK_LIGHT_ZIGBEE, True, True, True)
# self.desk_light.add_callback(self.amplifier.KEY_OUTPUT_0, True, self.desk_light_zigbee.power_on)
# self.desk_light.add_callback(self.amplifier.KEY_OUTPUT_0, False, self.desk_light_zigbee.power_off)
self.my_powerplug = pd.get(props.STG_MYA, loc, roo, props.FUN_MPP)
self.my_powerplug.add_channel_name(self.my_powerplug.KEY_OUTPUT_0, "Amplifier (gfw.dirk)")
self.my_powerplug.add_channel_name(self.my_powerplug.KEY_OUTPUT_1, "Phono (gfw.dirk)")
self.my_powerplug.add_channel_name(self.my_powerplug.KEY_OUTPUT_2, "CD_Player (gfw.dirk)")
self.my_powerplug.add_channel_name(self.my_powerplug.KEY_OUTPUT_3, "Bluetooth (gfw.dirk)")
self.heating_valve = pd.get(props.STG_ZGW, loc, roo, props.FUN_HEA)
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_MAIN_LIGHT_VIDEV, True, True, True)
# TODO: Add this again...
# self.videv_amplifier = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_AMPLIFIER_VIDEV, True, False, False)
# self.videv_desk_light = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_DESK_LIGHT_VIDEV, True, True, True)
# self.videv_cd_player = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_CD_PLAYER_VIDEV, True, False, False)
# self.videv_pc_dock = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_PC_DOCK_VIDEV, True, False, False)
self.videv_pc_dock = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_PC_DOCK_VIDEV, True, False, False)
self.videv_desk_light = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_DESK_LIGHT_VIDEV, True, True, True)
self.videv_amplifier = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_AMPLIFIER_VIDEV, True, False, False)
self.videv_cd_player = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_CD_PLAYER_VIDEV, True, False, False)
self.videv_bt = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_BT_VIDEV, True, False, False)
self.videv_phono = videv_light(mqtt_client, config.TOPIC_GFW_DIRK_PHONO_VIDEV, True, False, False)
#
self.videv_heating = videv_heating(mqtt_client, config.TOPIC_GFW_DIRK_HEATING_VALVE_VIDEV)
@ -120,7 +124,7 @@ class ffw_julian(base):
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light")
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light (ffw.julian)")
self.main_light_zigbee = pd.get(props.STG_ZFW, loc, roo, props.FUN_MAL)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off)
@ -136,7 +140,7 @@ class ffw_livingroom(base):
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light")
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light (ffw.livingroom)")
self.main_light_zigbee = pd.get(props.STG_ZFW, loc, roo, props.FUN_MAL)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off)
@ -152,7 +156,7 @@ class ffw_sleep(base):
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light")
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light (ffw.sleep)")
self.main_light_zigbee = pd.get(props.STG_ZFW, loc, roo, props.FUN_MAL)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off)
@ -178,7 +182,7 @@ class ffw_floor(base):
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light")
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light (ffw.floor)")
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFW_FLOOR_MAIN_LIGHT_VIDEV, True, False, False)
@ -199,7 +203,7 @@ class ffe_floor(base):
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light")
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light (ffe.floor)")
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFE_FLOOR_MAIN_LIGHT_VIDEV, True, False, False)
@ -212,11 +216,11 @@ class ffe_kitchen(base):
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light")
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light (ffe.kitchen)")
self.circulation_pump = pd.get(props.STG_SHE, loc, roo, props.FUN_CIR)
self.circulation_pump.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER) # , output_0_auto_off=10*60)
self.circulation_pump.add_channel_name(self.circulation_pump.KEY_OUTPUT_0, "Circulation Pump")
self.circulation_pump.add_channel_name(self.circulation_pump.KEY_OUTPUT_0, "Circulation Pump (ffe.kitchen)")
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFE_KITCHEN_MAIN_LIGHT_VIDEV, True, False, False)
@ -230,14 +234,14 @@ class ffe_diningroom(base):
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light")
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light (ffe.diningroom)")
self.floor_lamp = pd.get(props.STG_ZFE, loc, roo, props.FUN_FLL)
self.floor_lamp.add_channel_name(self.floor_lamp.KEY_OUTPUT_0, "Floor Lamp")
self.floor_lamp.add_channel_name(self.floor_lamp.KEY_OUTPUT_0, "Floor Lamp (ffe.diningroom)")
if config.CHRISTMAS:
self.garland = pd.get(props.STG_ZFE, loc, roo, props.FUN_GAR)
self.garland.add_channel_name(self.garland.KEY_OUTPUT_0, "Garland")
self.garland.add_channel_name(self.garland.KEY_OUTPUT_0, "Garland (ffe.diningroom)")
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFE_DININGROOM_MAIN_LIGHT_VIDEV, True, False, False)
@ -253,14 +257,14 @@ class ffe_sleep(base):
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light")
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light (ffe.sleep)")
self.main_light_zigbee = pd.get(props.STG_ZFE, loc, roo, props.FUN_MAL)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off)
self.bed_light_di_zigbee = pd.get(props.STG_ZFE, loc, roo, props.FUN_BLD)
self.bed_light_ma = pd.get(props.STG_ZFE, loc, roo, props.FUN_BLM)
self.bed_light_ma.add_channel_name(self.bed_light_ma.KEY_OUTPUT_0, "Bed light Marion")
self.bed_light_ma.add_channel_name(self.bed_light_ma.KEY_OUTPUT_0, "Bed light Marion (ffe.sleep)")
self.heating_valve = pd.get(props.STG_ZFE, loc, roo, props.FUN_HEA)
@ -280,7 +284,7 @@ class ffe_livingroom(base):
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light")
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light (ffe.livingroom)")
self.main_light_zigbee = pd.get(props.STG_ZFE, loc, roo, props.FUN_MAL)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, True, self.main_light_zigbee.power_on)
self.main_light.add_callback(self.main_light.KEY_OUTPUT_0, False, self.main_light_zigbee.power_off)
@ -289,9 +293,9 @@ class ffe_livingroom(base):
if config.CHRISTMAS:
self.xmas_tree = pd.get(props.STG_ZFE, loc, roo, props.FUN_XTR)
self.xmas_tree.add_channel_name(self.xmas_tree.KEY_OUTPUT_0, "Xmas-Tree")
self.xmas_tree.add_channel_name(self.xmas_tree.KEY_OUTPUT_0, "Xmas-Tree (ffe.livingroom)")
self.xmas_star = pd.get(props.STG_ZFE, loc, roo, props.FUN_XST)
self.xmas_star.add_channel_name(self.xmas_star.KEY_OUTPUT_0, "Xmas-Star")
self.xmas_star.add_channel_name(self.xmas_star.KEY_OUTPUT_0, "Xmas-Star (ffe.livingroom)")
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_VIDEV, True, True, True)
@ -316,7 +320,7 @@ class stairway(base):
#
self.main_light = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
self.main_light.configure(input_0_func=self.main_light.INPUT_FUNC_OUT1_TRIGGER)
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light")
self.main_light.add_channel_name(self.main_light.KEY_OUTPUT_0, "Main Light (stairway)")
#
self.videv_main_light = videv_light(mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_VIDEV, True, False, False, True)

View File

@ -19,9 +19,9 @@ def device_follow(tLogger, master, master_key, slave, slave_key, values):
# Test devices
for value in values:
tLogger.debug("Setting state of %s to %s", master.topic, repr(value))
tLogger.debug("Setting state of %s to %s", master.names.get(master_key, master.topic), repr(value))
master.set(master_key, value)
time.sleep(DELAY_SET_GET)
expectation = slave.get(slave_key)
time.sleep(DELAY_SET_GET)
equivalency_chk(expectation, value, tLogger, f"Value for {slave.topic}")
equivalency_chk(expectation, value, tLogger, f"Value for {slave.names.get(slave_key, slave.topic)}")

View File

@ -1,4 +1,4 @@
import config
import report
from mqtt import mqtt_client
@ -9,103 +9,206 @@ from .help import STATES_SW
from tests.common_testcases import device_follow
def main_light_videv_shelly_sw(ts, testcase_id, room, 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)
slave_key = getattr(slave, "KEY_OUTPUT_%d" % slave_ch)
ts.testCase(
testcase_id, report.TCEL_SINGLE if single else report.TCEL_SMOKE, device_follow,
room.videv_main_light, room.videv_main_light.KEY_OUTPUT_0,
room.main_light, room.main_light.KEY_OUTPUT_0,
STATES_SW
)
def main_light_shelly_videv_sw(ts, testcase_id, room, single=False):
ts.testCase(
testcase_id, report.TCEL_SINGLE if single else report.TCEL_FULL, device_follow,
room.main_light, room.main_light.KEY_OUTPUT_0,
room.videv_main_light, room.videv_main_light.KEY_OUTPUT_0,
master, master_key,
slave, slave_key,
STATES_SW
)
def ffe(ts: testSession, mc: mqtt_client, h: house):
# REQ 0001 - 0099
#
# ffe.livingroom
#
room = h.ffe.livingroom
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0001', room)
main_light_shelly_videv_sw(ts, 'REQ-0002', room)
# Switching devices ##################################
# main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0001', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0002', room.main_light, room.videv_main_light)
# floor_lamp videv<->zigbee + main_light->zigbee
device_follow_sw(ts, 'REQ-0003', room.videv_floor_lamp, room.floor_lamp_zigbee)
device_follow_sw(ts, 'REQ-0004', room.floor_lamp_zigbee, room.videv_floor_lamp)
device_follow_sw(ts, 'REQ-0005', room.main_light, room.floor_lamp_zigbee)
# xmas_tree videv<-->shelly
if config.CHRISTMAS:
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)
#
# ffe.sleep
#
room = h.ffe.sleep
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0011', room)
main_light_shelly_videv_sw(ts, 'REQ-0012', room)
# Switching devices ##################################
# main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0021', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0022', room.main_light, room.videv_main_light)
# bed_light_di videv<-->zigbee
device_follow_sw(ts, 'REQ-0023', room.videv_bed_light_di, room.bed_light_di_zigbee)
device_follow_sw(ts, 'REQ-0024', room.bed_light_di_zigbee, room.videv_bed_light_di)
#
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)
#
# ffe.diningroom
#
room = h.ffe.diningroom
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0021', room)
main_light_shelly_videv_sw(ts, 'REQ-0022', room)
# Switching devices ##################################
# main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0041', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0042', room.main_light, room.videv_main_light)
# floor_lamp videv<->zigbee + main_light->zigbee
device_follow_sw(ts, 'REQ-0043', room.videv_floor_lamp, room.floor_lamp)
device_follow_sw(ts, 'REQ-0044', room.floor_lamp, room.videv_floor_lamp)
device_follow_sw(ts, 'REQ-0045', room.main_light, room.floor_lamp)
# garland
if config.CHRISTMAS:
device_follow_sw(ts, 'REQ-0046', room.videv_garland, room.garland)
device_follow_sw(ts, 'REQ-0047', room.garland, room.videv_garland)
#
# ffe.kitchen
#
room = h.ffe.kitchen
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0031', room)
main_light_shelly_videv_sw(ts, 'REQ-0032', room)
# Switching devices ##################################
# main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0061', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0062', room.main_light, room.videv_main_light)
# 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)
h.ffe.floor
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0041', room)
main_light_shelly_videv_sw(ts, 'REQ-0042', room)
#
# ffe.floor
#
# Switching devices ##################################
room = h.ffe.floor
# main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0081', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0082', room.main_light, room.videv_main_light)
def ffw(ts: testSession, mc: mqtt_client, h: house):
# REQ 0101 - 0199
#
# ffw.livingroom
#
room = h.ffw.livingroom
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0101', room)
main_light_shelly_videv_sw(ts, 'REQ-0102', room)
# Switching devices ##################################
# main_light videv<-->shelly
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)
#
# ffw.sleep
#
room = h.ffw.sleep
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0111', room)
main_light_shelly_videv_sw(ts, 'REQ-0112', room, True)
# Switching devices ##################################
# main_light videv<-->shelly
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)
#
# ffw.julian
#
room = h.ffw.julian
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0121', room)
main_light_shelly_videv_sw(ts, 'REQ-0122', room)
# Switching devices ##################################
# main_light videv<-->shelly
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)
#
# ffw.bath
#
room = h.ffw.bath
# Switching devices ##################################
# ...
#
# ffw.floor
#
room = h.ffw.floor
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0141', room, True)
main_light_shelly_videv_sw(ts, 'REQ-0142', room, True)
# Switching devices ##################################
# main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0181', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0182', room.main_light, room.videv_main_light)
def gfe(ts: testSession, mc: mqtt_client, h: house):
# REQ 0201 - 0299
#
# gfe.
#
# room = h.gfe
# Switching devices ##################################
pass
def gfw(ts: testSession, mc: mqtt_client, h: house):
# REQ 0301 - 0399
#
# gfw.dirk
#
room = h.gfw.dirk
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0301', room)
main_light_shelly_videv_sw(ts, 'REQ-0302', room)
# Switching devices ##################################
# main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0301', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0302', room.main_light, room.videv_main_light)
# desk_light videv<-->tradfri
device_follow_sw(ts, 'REQ-0303', room.videv_desk_light, room.desk_light)
device_follow_sw(ts, 'REQ-0304', room.desk_light, room.videv_desk_light)
# desk_light videv<-->powerplug
device_follow_sw(ts, 'REQ-0305', room.videv_pc_dock, room.pc_dock)
device_follow_sw(ts, 'REQ-0306', room.pc_dock, room.videv_pc_dock)
# powerplug videv <-> channel
device_follow_sw(ts, 'REQ-0307', room.videv_amplifier, room.my_powerplug, slave_ch=0)
device_follow_sw(ts, 'REQ-0308', room.my_powerplug, room.videv_amplifier, master_ch=0)
device_follow_sw(ts, 'REQ-0309', room.videv_phono, room.my_powerplug, slave_ch=1)
device_follow_sw(ts, 'REQ-0310', room.my_powerplug, room.videv_phono, master_ch=1)
device_follow_sw(ts, 'REQ-0311', room.videv_cd_player, room.my_powerplug, slave_ch=2)
device_follow_sw(ts, 'REQ-0312', room.my_powerplug, room.videv_cd_player, master_ch=2)
device_follow_sw(ts, 'REQ-0313', room.videv_bt, room.my_powerplug, slave_ch=3)
device_follow_sw(ts, 'REQ-0314', room.my_powerplug, room.videv_bt, master_ch=3)
# powerplug follow
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-0317', room.my_powerplug, room.my_powerplug, master_ch=3, slave_ch=0)
#
# gfw.marion
#
room = h.gfw.marion
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0311', room)
main_light_shelly_videv_sw(ts, 'REQ-0312', room)
# Switching devices ##################################
# main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0341', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0342', room.main_light, room.videv_main_light)
# floor_lamp videv<->zigbee + main_light->zigbee
device_follow_sw(ts, 'REQ-0343', room.videv_window_light, room.window_light)
device_follow_sw(ts, 'REQ-0344', room.window_light, room.videv_window_light)
device_follow_sw(ts, 'REQ-0345', room.main_light, room.window_light)
#
# gfw.floor
#
room = h.gfw.floor
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0321', room)
main_light_shelly_videv_sw(ts, 'REQ-0322', room)
# Switching devices ##################################
# main_light videv<-->shelly
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)
def stw(ts: testSession, mc: mqtt_client, h: house):
# REQ 0401 - 0499
#
# stairways
#
room = h.stairway
# main_light videv->shelly
main_light_videv_shelly_sw(ts, 'REQ-0401', room)
main_light_shelly_videv_sw(ts, 'REQ-0402', room)
# Switching devices ##################################
# main_light videv<-->shelly
device_follow_sw(ts, 'REQ-0401', room.videv_main_light, room.main_light)
device_follow_sw(ts, 'REQ-0402', room.main_light, room.videv_main_light)