from collections import UserString # # Device TYpe definitions # DTY_SHY_SW1 = 1 """ Shelly """ DTY_TLI_Sxx = 2 """ Tradfri Light (Switching only) """ DTY_TLI_SBx = 3 """ Tradfri Light (Switching and Brightnes) """ DTY_TLI_SBT = 4 """ Tradfri Light (Switching, Brightnes and Colortemperature) """ DTY_TIN_5xx = 5 """ Tradfri Input Device (5 Buttons) """ DTY_LLI_SBT = 6 """ Livarno Light (Switching, Brightnes and Colortemperature) """ DTY_BVL_xxx = 7 """ Brennenstuhl Heatingvalve """ DTY_SPP_SW1 = 8 """ Silvercrest Powerplug """ DTY_SMS_xxx = 9 """ Silvercrest Motion Sensor """ DTY_MPP_4xx = 10 """ My Powerplug (4 plugs) """ DTY_MAS_xxx = 11 """ My Audio status (MPD) """ DTY_MRE_xxx = 12 """ My Remote control """ DTY_MAM_THP = 13 """ My Ambient Information (Temperature, Humidity, Pressure)""" DTY_HLI_SBT = 14 """ Hue Light (Switching, Brightnes and Colortemperature) """ # # Source Transmission Group # STG_ZGW = 1 """ Zigbee ground floor west """ STG_ZFW = 2 """ Zigbee first floor west """ STG_ZFE = 3 """ Zigbee first floor east """ STG_SHE = 4 """ Shellies """ STG_MYA = 5 """ My Applications """ STG_VDE = 6 """ Videv Devices """ # # LOCation # LOC_GFW = 1 """ Ground floor west """ LOC_GFE = 2 """ Ground floor east """ LOC_STW = 3 """ Stairway """ LOC_FFW = 4 """ First floor west """ LOC_FFE = 5 """ First floor east """ LOC_STW = 6 """ Stairways """ LOC_GAR = 7 # # ROOms # ROO_DIN = 1 """ Diningroom """ ROO_KIT = 2 """ Kitchen """ ROO_LIV = 3 """ Livingroom """ ROO_FLO = 4 """ Floor """ ROO_SLP = 5 """ Sleep """ ROO_BAT = 6 """ Bath """ ROO_DIR = 7 """ Dirk """ ROO_MAR = 8 """ Marion """ ROO_JUL = 9 """ Julian """ ROO_STG = 10 """ ground floor """ ROO_STF = 11 """ first floor """ ROO_GAR = 12 """ garden """ # # FUNctions # FUN_MAL = 1 """ Main Light """ FUN_DEL = 2 """ Desk Light """ FUN_FLL = 3 """ Floor Light """ FUN_BLD = 4 """ Bed Light Dirk """ FUN_BLM = 5 """ Bed Light Marion """ FUN_HEA = 6 """ Heating """ FUN_MPP = 7 """ Multiple Powerplugs """ FUN_INP = 8 """ Input Device """ FUN_CIR = 9 """ Circulation Pump """ FUN_GAR = 10 """ Garland """ FUN_XTR = 11 """ X-Mas Tree """ FUN_XST = 12 """ X-Mas Star """ FUN_MSE = 13 """ Motion Sensor """ FUN_RCA = 14 """ Remote Control Amplifier """ FUN_RCC = 15 """ Remote Control CD-Player """ FUN_ASS = 16 """ Audio status spotify """ FUN_ASM = 17 """ Audio status mpd """ FUN_ASB = 18 """ Audio status bluetooth """ FUN_DCK = 19 """ Docking Station """ FUN_AMB = 20 """ Ambient information """ FUN_REP = 21 """" Repeater suppla """ FUN_WLI = 22 """ Warddrobe light """ FUN_WIL = 23 """ Window light """ FUN_AMP = 24 """ Amplifier """ FUN_CDP = 25 """ CD Player """ FUN_BTP = 26 """ Bluetooth """ FUN_PHO = 27 """ Phono """ FUN_VMS = 28 """ Virtual Multi State""" STG_TOPIC = { STG_ZGW: 'zigbee_gfw', STG_ZFW: 'zigbee_ffw', STG_ZFE: 'zigbee_ffe', STG_SHE: 'shellies', STG_MYA: 'my_apps', STG_VDE: 'videv', } LOC_TOPIC = { LOC_GFE: 'gfe', LOC_GFW: 'gfw', LOC_FFE: 'ffe', LOC_FFW: 'ffw', LOC_GAR: 'gar', LOC_STW: 'stw', } ROO_TOPIC = { ROO_DIN: 'diningroom', ROO_KIT: 'kitchen', ROO_LIV: 'livingroom', ROO_FLO: 'floor', ROO_SLP: 'sleep', ROO_BAT: 'bath', ROO_DIR: 'dirk', ROO_MAR: 'marion', ROO_JUL: 'julian', ROO_STG: 'groundfloor', ROO_STF: 'firstfloor', ROO_GAR: 'garden', } FUN_TOPIC = { FUN_MAL: 'main_light', FUN_DEL: 'desk_light', FUN_FLL: 'floor_light', FUN_BLD: 'bed_light_di', FUN_BLM: 'bed_light_ma', FUN_HEA: 'heating_valve', FUN_MPP: 'powerplug', FUN_INP: 'input_device', FUN_DCK: 'dock', FUN_CIR: 'circulation_pump', FUN_GAR: 'garland', FUN_XTR: 'xmas-tree', FUN_XST: 'xmas-star', FUN_MSE: 'motion_sensor', FUN_RCA: 'remote_ctrl/RAS5', FUN_RCC: 'remote_ctrl/EUR642100', FUN_ASS: 'audio_status_spotify', FUN_ASM: 'audio_status_mpd', FUN_ASB: 'audio_status_bt', FUN_AMB: 'ambient', FUN_REP: 'repeater', FUN_WLI: 'wardrobe_light', FUN_WIL: 'window_light', FUN_AMP: 'amplifier', FUN_CDP: 'cd_player', FUN_BTP: 'bt', FUN_PHO: 'phono', FUN_VMS: 'active_brightness_device', } def get_topic(stg, loc, roo, fun): stg_topic = STG_TOPIC[stg] loc_topic = LOC_TOPIC[loc] roo_topic = ROO_TOPIC[roo] fun_topic = FUN_TOPIC[fun] s = '/'.join([stg_topic, loc_topic, roo_topic, fun_topic]) # TODO: /!\ Changed TOPIC in VIDEV /!\ - Remove this line after changing nodered if stg == STG_VDE and fun == FUN_DCK: s = '/'.join([stg_topic, loc_topic, roo_topic, 'pc_dock']) if stg == STG_VDE and fun == FUN_FLL: s = '/'.join([stg_topic, loc_topic, roo_topic, 'floorlamp']) if stg == STG_VDE and roo == ROO_STF and fun == FUN_MAL: import config # nopep8 s = config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_VIDEV if stg == STG_VDE and fun == FUN_XTR: s = '/'.join([stg_topic, loc_topic, roo_topic, 'xmas_tree']) # TODO: /!\ Changed TOPIC in VIDEV /!\ - Remove this line after changing nodered return s