import config import report from mqtt import mqtt_client from simulation.rooms import house from .help import testSession from .help import STATES_SW from tests.common_testcases import device_follow 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, 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 # 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 # 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 # 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 # 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) # # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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)