Adaption to support currently used topics
This commit is contained in:
parent
a5a55a1580
commit
6d41c39ee3
236
__init__.py
236
__init__.py
@ -3,6 +3,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
from devdi import props
|
from devdi import props
|
||||||
|
from devices import group
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -20,124 +21,189 @@ class devices(dict):
|
|||||||
|
|
||||||
def __init__(self, mqtt_client):
|
def __init__(self, mqtt_client):
|
||||||
dict.__init__(self)
|
dict.__init__(self)
|
||||||
#######
|
self.__init_gfw__(mqtt_client)
|
||||||
# GFW #
|
self.__init_ffw__(mqtt_client)
|
||||||
#######
|
self.__init_ffe__(mqtt_client)
|
||||||
|
self.__init_stw__(mqtt_client)
|
||||||
|
|
||||||
|
def __init_gfw__(self, mqtt_client):
|
||||||
loc = props.LOC_GFW
|
loc = props.LOC_GFW
|
||||||
|
|
||||||
# MARION
|
# MARION
|
||||||
roo = props.ROO_MAR
|
roo = props.ROO_MAR
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1) # Shelly Main Light
|
# Temporary to fit to current implementation ###################################################
|
||||||
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx) # Brennenstuhl Heatingvalve
|
TOPIC_GFW_MARION_MAIN_LIGHT_SHELLY = "shellies/gfw/marion/main_light"
|
||||||
|
TOPIC_GFW_MARION_HEATING_VALVE_ZIGBEE = "zigbee/gfw/marion/heating_valve"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1, ot=TOPIC_GFW_MARION_MAIN_LIGHT_SHELLY) # Shelly Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx, ot=TOPIC_GFW_MARION_HEATING_VALVE_ZIGBEE) # Brennenstuhl Heatingvalve
|
||||||
|
|
||||||
# FLOOR
|
# FLOOR
|
||||||
roo = props.ROO_FLO
|
roo = props.ROO_FLO
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1) # Shelly Main Light
|
# Temporary to fit to current implementation ###################################################
|
||||||
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_MAL, props.DTY_LLI_SBT, 1) # Tradfri Main Light
|
TOPIC_GFW_FLOOR_MAIN_LIGHT_SHELLY = "shellies/gfw/floor/main_light"
|
||||||
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_MAL, props.DTY_LLI_SBT, 2) # Tradfri Main Light
|
TOPIC_GFW_FLOOR_MAIN_LIGHT_ZIGBEE = "zigbee/gfw/floor/main_light_%d"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1, ot=TOPIC_GFW_FLOOR_MAIN_LIGHT_SHELLY) # Shelly Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_MAL, props.DTY_LLI_SBT, range(1,3), ot=TOPIC_GFW_FLOOR_MAIN_LIGHT_ZIGBEE) # Tradfri Main Light
|
||||||
|
|
||||||
# DIRK
|
# DIRK
|
||||||
roo = props.ROO_DIR
|
roo = props.ROO_DIR
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1) # Shelly Main Light
|
# Temporary to fit to current implementation ###################################################
|
||||||
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_MAL, props.DTY_TLI_SBT) # Tradfri Main Light
|
TOPIC_GFW_DIRK_MAIN_LIGHT_SHELLY = "shellies/gfw/dirk/main_light"
|
||||||
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_CTR, props.DTY_TIN_5xx) # Tradfri Input Device 5 Buttons
|
TOPIC_GFW_DIRK_MAIN_LIGHT_ZIGBEE = "zigbee/gfw/dirk/main_light"
|
||||||
self.add(mqtt_client, props.STG_MYA, loc, roo, props.FUN_MPP, props.DTY_MPP_4xx) # My 4 port Powerplug
|
TOPIC_GFW_DIRK_INPUT_DEVICE = "zigbee/gfw/dirk/input_device"
|
||||||
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_DEL, props.DTY_TLI_SBT) , # Tradfri Desklight
|
TOPIC_GFW_DIRK_POWERPLUG = "my_apps/gfw/dirk/powerplug"
|
||||||
self.add(mqtt_client, props.STG_MYA, loc, roo, props.FUN_RCA, props.DTY_MRE_xxx) # Remote Control IR Amplifier
|
TOPIC_GFW_DIRK_DESK_LIGHT_ZIGBEE = "zigbee/gfw/dirk/desk_light"
|
||||||
self.add(mqtt_client, props.STG_MYA, loc, roo, props.FUN_ASS, props.DTY_MAS_xxx) # Audio status Spotify
|
TOPIC_GFW_DIRK_AMPLIFIER_REMOTE = "my_apps/gfw/dirk/remote/RAS5"
|
||||||
self.add(mqtt_client, props.STG_MYA, loc, roo, props.FUN_ASM, props.DTY_MAS_xxx) # Audio status MPD
|
TOPIC_GFW_DIRK_SPOTIFY = "my_apps/gfw/dirk/hifi/spotify"
|
||||||
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx) # Brennenstuhl Heatingvalve
|
TOPIC_GFW_DIRK_MPD = "my_apps/gfw/dirk/hifi/mpd"
|
||||||
|
TOPIC_GFW_DIRK_HEATING_VALVE_ZIGBEE = "zigbee/gfw/dirk/heating_valve"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1, ot=TOPIC_GFW_DIRK_MAIN_LIGHT_SHELLY) # Shelly Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_MAL, props.DTY_TLI_SBT, ot=TOPIC_GFW_DIRK_MAIN_LIGHT_ZIGBEE) # Tradfri Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_INP, props.DTY_TIN_5xx, ot=TOPIC_GFW_DIRK_INPUT_DEVICE) # Tradfri Input Device 5 Buttons
|
||||||
|
self.add(mqtt_client, props.STG_MYA, loc, roo, props.FUN_MPP, props.DTY_MPP_4xx, ot=TOPIC_GFW_DIRK_POWERPLUG) # My 4 port Powerplug
|
||||||
|
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_DEL, props.DTY_TLI_SBT, ot=TOPIC_GFW_DIRK_DESK_LIGHT_ZIGBEE) , # Tradfri Desklight
|
||||||
|
self.add(mqtt_client, props.STG_MYA, loc, roo, props.FUN_RCA, props.DTY_MRE_xxx, ot=TOPIC_GFW_DIRK_AMPLIFIER_REMOTE) # Remote Control IR Amplifier
|
||||||
|
self.add(mqtt_client, props.STG_MYA, loc, roo, props.FUN_ASS, props.DTY_MAS_xxx, ot=TOPIC_GFW_DIRK_SPOTIFY) # Audio status Spotify
|
||||||
|
self.add(mqtt_client, props.STG_MYA, loc, roo, props.FUN_ASM, props.DTY_MAS_xxx, ot=TOPIC_GFW_DIRK_MPD) # Audio status MPD
|
||||||
|
self.add(mqtt_client, props.STG_ZGW, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx, ot=TOPIC_GFW_DIRK_HEATING_VALVE_ZIGBEE) # Brennenstuhl Heatingvalve
|
||||||
|
|
||||||
|
def __init_ffw__(self, mqtt_client):
|
||||||
#######
|
|
||||||
# FFW #
|
|
||||||
#######
|
|
||||||
loc = props.LOC_FFW
|
loc = props.LOC_FFW
|
||||||
# JULIAN
|
# JULIAN
|
||||||
roo = props.ROO_JUL
|
roo = props.ROO_JUL
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1) # Shelly Main Light
|
# Temporary to fit to current implementation ###################################################
|
||||||
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_MAL, props.DTY_TLI_SBT) # Tradfri Main Light
|
TOPIC_FFW_JULIAN_MAIN_LIGHT_SHELLY = "shellies/ffw/julian/main_light"
|
||||||
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx) # Brennenstuhl Heatingvalve
|
TOPIC_FFW_JULIAN_MAIN_LIGHT_ZIGBEE = "zigbee/ffw/julian/main_light"
|
||||||
|
TOPIC_FFW_JULIAN_HEATING_VALVE_ZIGBEE = "zigbee/ffw/julian/heating_valve"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1, ot=TOPIC_FFW_JULIAN_MAIN_LIGHT_SHELLY) # Shelly Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_MAL, props.DTY_TLI_SBT, ot=TOPIC_FFW_JULIAN_MAIN_LIGHT_ZIGBEE) # Tradfri Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx, ot=TOPIC_FFW_JULIAN_HEATING_VALVE_ZIGBEE) # Brennenstuhl Heatingvalve
|
||||||
|
|
||||||
# BATH
|
# BATH
|
||||||
roo = props.ROO_BAT
|
roo = props.ROO_BAT
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx) # Brennenstuhl Heatingvalve
|
# Temporary to fit to current implementation
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
TOPIC_FFW_BATH_HEATING_VALVE_ZIGBEE = "zigbee/ffw/bath/heating_valve"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx, ot=TOPIC_FFW_BATH_HEATING_VALVE_ZIGBEE) # Brennenstuhl Heatingvalve
|
||||||
|
|
||||||
# LIVINGROOM
|
# LIVINGROOM
|
||||||
roo = props.ROO_LIV
|
roo = props.ROO_LIV
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1) # Shelly Main Light
|
# Temporary to fit to current implementation ###################################################
|
||||||
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_MAL, props.DTY_TLI_SBT) # Tradfri Main Light
|
TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_SHELLY = "shellies/ffw/livingroom/main_light"
|
||||||
|
TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_ZIGBEE = "zigbee/ffw/livingroom/main_light"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1, ot=TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_SHELLY) # Shelly Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_MAL, props.DTY_TLI_SBT, ot=TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_ZIGBEE) # Tradfri Main Light
|
||||||
|
|
||||||
# SLEEP
|
# SLEEP
|
||||||
roo = props.ROO_SLP
|
roo = props.ROO_SLP
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1) # Shelly Main Light
|
# Temporary to fit to current implementation ###################################################
|
||||||
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_MAL, props.DTY_TLI_SBx) # Tradfri Main Light
|
TOPIC_FFW_SLEEP_MAIN_LIGHT_SHELLY = "shellies/ffw/sleep/main_light"
|
||||||
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx) # Brennenstuhl Heatingvalve
|
TOPIC_FFW_SLEEP_MAIN_LIGHT_ZIGBEE = "zigbee/ffw/sleep/main_light"
|
||||||
|
TOPIC_FFW_SLEEP_HEATING_VALVE_ZIGBEE = "zigbee/ffw/sleep/heating_valve"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1, ot=TOPIC_FFW_SLEEP_MAIN_LIGHT_SHELLY) # Shelly Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_MAL, props.DTY_TLI_SBx, ot=TOPIC_FFW_SLEEP_MAIN_LIGHT_ZIGBEE) # Tradfri Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx, ot=TOPIC_FFW_SLEEP_HEATING_VALVE_ZIGBEE) # Brennenstuhl Heatingvalve
|
||||||
|
|
||||||
#######
|
def __init_ffe__(self, mqtt_client):
|
||||||
# FFE #
|
|
||||||
#######
|
|
||||||
loc = props.LOC_FFE
|
loc = props.LOC_FFE
|
||||||
# FLOOR
|
# FLOOR
|
||||||
roo = props.ROO_FLO
|
roo = props.ROO_FLO
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1) # Shelly Main Light
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
TOPIC_FFE_FLOOR_MAIN_LIGHT_SHELLY = "shellies/ffe/floor/main_light"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1, ot=TOPIC_FFE_FLOOR_MAIN_LIGHT_SHELLY) # Shelly Main Light
|
||||||
|
|
||||||
# KITCHEN
|
# KITCHEN
|
||||||
roo = props.ROO_KIT
|
roo = props.ROO_KIT
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1) # Shelly Main Light
|
# Temporary to fit to current implementation ###################################################
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_CIR, props.DTY_SHY_SW1) # Shelly Main Light
|
TOPIC_FFE_KITCHEN_MAIN_LIGHT_SHELLY = "shellies/ffe/kitchen/main_light"
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx) # Brennenstuhl Heatingvalve
|
TOPIC_FFE_KITCHEN_CIRCULATION_PUMP_SHELLY = "shellies/ffe/kitchen/circulation_pump"
|
||||||
|
TOPIC_FFE_KITCHEN_HEATING_VALVE_ZIGBEE = "zigbee/ffe/kitchen/heating_valve"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1, ot=TOPIC_FFE_KITCHEN_MAIN_LIGHT_SHELLY) # Shelly Main Light
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_CIR, props.DTY_SHY_SW1, ot=TOPIC_FFE_KITCHEN_CIRCULATION_PUMP_SHELLY) # Shelly Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx, ot=TOPIC_FFE_KITCHEN_HEATING_VALVE_ZIGBEE) # Brennenstuhl Heatingvalve
|
||||||
|
|
||||||
# DININGROOM
|
# DININGROOM
|
||||||
roo = props.ROO_DIN
|
roo = props.ROO_DIN
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1) # Shelly Main Light
|
# Temporary to fit to current implementation ###################################################
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_FLL, props.DTY_SPP_SW1) # Powerplug Floor Light
|
TOPIC_FFE_DININGROOM_MAIN_LIGHT_SHELLY = "shellies/ffe/diningroom/main_light"
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_GAR, props.DTY_SPP_SW1) # Powerplug Garland
|
TOPIC_FFE_DININGROOM_FLOOR_LAMP_POWERPLUG = "zigbee/ffe/diningroom/powerplug_floorlamp"
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx) # Brennenstuhl Heatingvalve
|
TOPIC_FFE_DININGROOM_GARLAND_POWERPLUG = "zigbee/ffe/diningroom/garland"
|
||||||
|
TOPIC_FFE_DININGROOM_HEATING_VALVE_ZIGBEE = "zigbee/ffe/diningroom/heating_valve"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1, ot=TOPIC_FFE_DININGROOM_MAIN_LIGHT_SHELLY) # Shelly Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_FLL, props.DTY_SPP_SW1, ot=TOPIC_FFE_DININGROOM_FLOOR_LAMP_POWERPLUG) # Powerplug Floor Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_GAR, props.DTY_SPP_SW1, ot=TOPIC_FFE_DININGROOM_GARLAND_POWERPLUG) # Powerplug Garland
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx, ot=TOPIC_FFE_DININGROOM_HEATING_VALVE_ZIGBEE) # Brennenstuhl Heatingvalve
|
||||||
|
|
||||||
# SLEEP
|
# SLEEP
|
||||||
roo = props.ROO_SLP
|
roo = props.ROO_SLP
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1) # Shelly Main Light
|
# Temporary to fit to current implementation ###################################################
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_MAL, props.DTY_TLI_SBT) # Tradfri Main Light
|
TOPIC_FFE_SLEEP_MAIN_LIGHT_SHELLY = "shellies/ffe/sleep/main_light"
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_CTR, props.DTY_TIN_5xx) # Tradfri Input Device 5 Buttons
|
TOPIC_FFE_SLEEP_MAIN_LIGHT_ZIGBEE = "zigbee/ffe/sleep/main_light"
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_BLD, props.DTY_TLI_SBx) # Tradfri Bed Light Dirk
|
TOPIC_FFE_SLEEP_INPUT_DEVICE = "zigbee/ffe/sleep/input_device"
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_BLM, props.DTY_SPP_SW1) # Powerplug Bed Light Marion
|
TOPIC_FFE_SLEEP_BED_LIGHT_DI_ZIGBEE = "zigbee/ffe/sleep/bed_light_di"
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx) # Brennenstuhl Heatingvalve
|
TOPIC_FFE_SLEEP_BED_LIGHT_MA_POWERPLUG = "zigbee/ffe/sleep/bed_light_ma"
|
||||||
|
TOPIC_FFE_SLEEP_HEATING_VALVE_ZIGBEE = "zigbee/ffe/sleep/heating_valve"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1, ot=TOPIC_FFE_SLEEP_MAIN_LIGHT_SHELLY) # Shelly Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_MAL, props.DTY_TLI_SBT, ot=TOPIC_FFE_SLEEP_MAIN_LIGHT_ZIGBEE) # Tradfri Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_INP, props.DTY_TIN_5xx, ot=TOPIC_FFE_SLEEP_INPUT_DEVICE) # Tradfri Input Device 5 Buttons
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_BLD, props.DTY_TLI_SBx, ot=TOPIC_FFE_SLEEP_BED_LIGHT_DI_ZIGBEE) # Tradfri Bed Light Dirk
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_BLM, props.DTY_SPP_SW1, ot=TOPIC_FFE_SLEEP_BED_LIGHT_MA_POWERPLUG) # Powerplug Bed Light Marion
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx, ot=TOPIC_FFE_SLEEP_HEATING_VALVE_ZIGBEE) # Brennenstuhl Heatingvalve
|
||||||
|
|
||||||
# LIVINGROOM
|
# LIVINGROOM
|
||||||
roo = props.ROO_LIV
|
roo = props.ROO_LIV
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1) # Shelly Main Light
|
# Temporary to fit to current implementation ###################################################
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_MAL, props.DTY_TLI_SBT) # Tradfri Main Light
|
TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_SHELLY = "shellies/ffe/livingroom/main_light"
|
||||||
for i in range(1, 7):
|
TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_ZIGBEE = "zigbee/ffe/livingroom/main_light"
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_FLL, props.DTY_TLI_SBT, i) # Tradfri Main Light
|
TOPIC_FFE_LIVINGROOM_FLOOR_LAMP_ZIGBEE = "zigbee/ffe/livingroom/floorlamp_%d"
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_XTR, props.DTY_SPP_SW1) # Tradfri Main Light
|
TOPIC_FFE_LIVINGROOM_XMAS_TREE_POWERPLUG = "zigbee/ffe/livingroom/powerplug_xmas-tree"
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_XST, props.DTY_SPP_SW1) # Tradfri Main Light
|
TOPIC_FFE_LIVINGROOM_XMAS_STAR_POWERPLUG = "zigbee/ffe/livingroom/powerplug_xmas-star"
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx) # Brennenstuhl Heatingvalve
|
TOPIC_FFE_LIVINGROOM_HEATING_VALVE_ZIGBEE = "zigbee/ffe/livingroom/heating_valve"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1, ot=TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_SHELLY) # Shelly Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_MAL, props.DTY_TLI_SBT, ot=TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_ZIGBEE) # Tradfri Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_FLL, props.DTY_TLI_SBT, range(1, 7), ot=TOPIC_FFE_LIVINGROOM_FLOOR_LAMP_ZIGBEE) # Tradfri Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_XTR, props.DTY_SPP_SW1, ot=TOPIC_FFE_LIVINGROOM_XMAS_TREE_POWERPLUG) # Tradfri Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_XST, props.DTY_SPP_SW1, ot=TOPIC_FFE_LIVINGROOM_XMAS_STAR_POWERPLUG) # Tradfri Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_HEA, props.DTY_BVL_xxx, ot=TOPIC_FFE_LIVINGROOM_HEATING_VALVE_ZIGBEE) # Brennenstuhl Heatingvalve
|
||||||
|
|
||||||
#######
|
def __init_stw__(self, mqtt_client):
|
||||||
# STW #
|
|
||||||
#######
|
|
||||||
loc = props.LOC_STW
|
loc = props.LOC_STW
|
||||||
# FLOOR
|
# FLOOR
|
||||||
roo = props.ROO_STW
|
|
||||||
#
|
#
|
||||||
self.add(mqtt_client, props.STG_SHE, loc, roo, props.FUN_MAL, props.DTY_SHY_SW1) # Shelly Main Light
|
# Temporary to fit to current implementation ###################################################
|
||||||
self.add(mqtt_client, props.STG_ZFW, loc, roo, props.FUN_MSE, props.DTY_SMS_xxx, 1) # Motion Sensor Ground Floor
|
TOPIC_STW_STAIRWAY_MAIN_LIGHT_SHELLY = "shellies/stw/stairway/main_light"
|
||||||
self.add(mqtt_client, props.STG_ZFE, loc, roo, props.FUN_MSE, props.DTY_SMS_xxx, 2) # Motion Sensor Ground Floor
|
TOPIC_STW_STAIRWAY_MAIN_LIGHT_MOTION_SENSOR_FF = "zigbee/ffe/stairway/motion_sensor_ff"
|
||||||
|
TOPIC_STW_STAIRWAY_MAIN_LIGHT_MOTION_SENSOR_GF = "zigbee/gfw/stairway/motion_sensor_gf"
|
||||||
|
# Temporary to fit to current implementation ###################################################
|
||||||
|
self.add(mqtt_client, props.STG_SHE, loc, props.ROO_STF, props.FUN_MAL, props.DTY_SHY_SW1, ot=TOPIC_STW_STAIRWAY_MAIN_LIGHT_SHELLY) # Shelly Main Light
|
||||||
|
self.add(mqtt_client, props.STG_ZFE, loc, props.ROO_STF, props.FUN_MSE, props.DTY_SMS_xxx, ot=TOPIC_STW_STAIRWAY_MAIN_LIGHT_MOTION_SENSOR_FF) # Motion Sensor First Floor
|
||||||
|
self.add(mqtt_client, props.STG_ZGW, loc, props.ROO_STG, props.FUN_MSE, props.DTY_SMS_xxx, ot=TOPIC_STW_STAIRWAY_MAIN_LIGHT_MOTION_SENSOR_GF) # Motion Sensor Ground Floor
|
||||||
|
|
||||||
def add(self, mqtt_client, stg, loc, roo, fun, dty, num=None):
|
def add(self, mqtt_client, stg, loc, roo, fun, dty, num=None, ot=None):
|
||||||
"""Method to initilise a device
|
"""Method to initilise a device
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -148,14 +214,32 @@ class devices(dict):
|
|||||||
dty (numeric): Device type (see DTP_* in props)
|
dty (numeric): Device type (see DTP_* in props)
|
||||||
num (numeric): Device number in case of multiple devices
|
num (numeric): Device number in case of multiple devices
|
||||||
"""
|
"""
|
||||||
topic = self.__topic__(stg, loc, roo, fun, num)
|
def get_device(dty, mqtt_client, topic, ot):
|
||||||
dev_class = props.dty_repr(dty)
|
# Temporary to fit to current implementation
|
||||||
if dev_class is None:
|
if ot != topic:
|
||||||
logger.warning('Device type %d is not yet implemented. Topic %s will not be supported.', dty, topic)
|
logger.error("Topic change for %s: Using this one: %s", topic, ot)
|
||||||
else:
|
topic = ot
|
||||||
self[topic] = dev_class(mqtt_client, topic)
|
dev_class = props.dty_repr(dty)
|
||||||
|
if dev_class is None:
|
||||||
|
logger.warning('Device type %d is not yet implemented. Topic %s will not be supported.', dty, topic)
|
||||||
|
else:
|
||||||
|
return dev_class(mqtt_client, topic)
|
||||||
|
|
||||||
def get(self, stg, loc, roo, fun, num=None):
|
topic = self.__topic__(stg, loc, roo, fun)
|
||||||
|
if num is None:
|
||||||
|
this_device = get_device(dty, mqtt_client, topic, ot)
|
||||||
|
if this_device is None:
|
||||||
|
logger.warning('Device type %d is not yet implemented. Topic %s will not be supported.', dty, topic)
|
||||||
|
else:
|
||||||
|
self[topic] = this_device
|
||||||
|
else:
|
||||||
|
dg = []
|
||||||
|
for i in num:
|
||||||
|
device_topic = self.__topic__(stg, loc, roo, fun) + '_%d' % i
|
||||||
|
dg.append(get_device(dty, mqtt_client, device_topic, ot=ot % i))
|
||||||
|
self[topic] = group(*dg)
|
||||||
|
|
||||||
|
def get(self, stg, loc, roo, fun):
|
||||||
"""Method to get a device
|
"""Method to get a device
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -165,25 +249,21 @@ class devices(dict):
|
|||||||
fun (numeric): Function (see FUN_* in props)
|
fun (numeric): Function (see FUN_* in props)
|
||||||
num (numeric): Device number in case of multiple devices
|
num (numeric): Device number in case of multiple devices
|
||||||
"""
|
"""
|
||||||
return self[self.__topic__(stg, loc, roo, fun, num)]
|
topic = self.__topic__(stg, loc, roo, fun)
|
||||||
|
return self[topic]
|
||||||
|
|
||||||
def __topic__(self, stg, loc, roo, fun, num):
|
def __topic__(self, stg, loc, roo, fun):
|
||||||
if num is None:
|
|
||||||
postfix = ""
|
|
||||||
else:
|
|
||||||
postfix = "_%d" % num
|
|
||||||
#
|
|
||||||
if stg in [props.STG_ZFE, props.STG_ZFW, props.STG_ZGW]:
|
if stg in [props.STG_ZFE, props.STG_ZFW, props.STG_ZGW]:
|
||||||
# Temporary to fit to current implementation
|
# Temporary to fit to current implementation
|
||||||
return '/'.join([
|
return '/'.join([
|
||||||
props.stg_repr(stg),
|
props.stg_repr(stg),
|
||||||
props.roo_repr(roo),
|
props.roo_repr(roo),
|
||||||
props.fun_repr(fun)
|
props.fun_repr(fun)
|
||||||
]) + postfix
|
])
|
||||||
else:
|
else:
|
||||||
return '/'.join([
|
return '/'.join([
|
||||||
props.stg_repr(stg),
|
props.stg_repr(stg),
|
||||||
props.loc_repr(loc),
|
props.loc_repr(loc),
|
||||||
props.roo_repr(roo),
|
props.roo_repr(roo),
|
||||||
props.fun_repr(fun)
|
props.fun_repr(fun)
|
||||||
]) + postfix
|
])
|
||||||
|
22
props.py
22
props.py
@ -79,6 +79,8 @@ LOC_FFW = 4
|
|||||||
""" First floor west """
|
""" First floor west """
|
||||||
LOC_FFE = 5
|
LOC_FFE = 5
|
||||||
""" First floor east """
|
""" First floor east """
|
||||||
|
LOC_STW = 6
|
||||||
|
""" Stairways """
|
||||||
def loc_repr(loc):
|
def loc_repr(loc):
|
||||||
return {
|
return {
|
||||||
LOC_GFW: 'gfw',
|
LOC_GFW: 'gfw',
|
||||||
@ -86,6 +88,7 @@ def loc_repr(loc):
|
|||||||
LOC_STW: 'stw',
|
LOC_STW: 'stw',
|
||||||
LOC_FFW: 'ffw',
|
LOC_FFW: 'ffw',
|
||||||
LOC_FFE: 'ffe',
|
LOC_FFE: 'ffe',
|
||||||
|
LOC_STW: 'stw',
|
||||||
}.get(loc)
|
}.get(loc)
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -109,8 +112,10 @@ ROO_MAR = 8
|
|||||||
""" Marion """
|
""" Marion """
|
||||||
ROO_JUL = 9
|
ROO_JUL = 9
|
||||||
""" Julian """
|
""" Julian """
|
||||||
ROO_STW = 10
|
ROO_STG = 10
|
||||||
""" Stairway """
|
""" ground floor """
|
||||||
|
ROO_STF = 11
|
||||||
|
""" first floor """
|
||||||
def roo_repr(roo):
|
def roo_repr(roo):
|
||||||
return {
|
return {
|
||||||
ROO_DIN: 'diningroom',
|
ROO_DIN: 'diningroom',
|
||||||
@ -122,7 +127,8 @@ def roo_repr(roo):
|
|||||||
ROO_DIR: 'dirk',
|
ROO_DIR: 'dirk',
|
||||||
ROO_MAR: 'marion',
|
ROO_MAR: 'marion',
|
||||||
ROO_JUL: 'julian',
|
ROO_JUL: 'julian',
|
||||||
ROO_STW: 'stairway',
|
ROO_STG: 'groundfloor',
|
||||||
|
ROO_STF: 'firstfloor'
|
||||||
}.get(roo)
|
}.get(roo)
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -142,8 +148,8 @@ FUN_HEA = 6
|
|||||||
""" Heating """
|
""" Heating """
|
||||||
FUN_MPP = 7
|
FUN_MPP = 7
|
||||||
""" Multiple Powerplugs """
|
""" Multiple Powerplugs """
|
||||||
FUN_CTR = 8
|
FUN_INP = 8
|
||||||
""" Control """
|
""" Input Device """
|
||||||
FUN_CIR = 9
|
FUN_CIR = 9
|
||||||
""" Circulation Pump """
|
""" Circulation Pump """
|
||||||
FUN_GAR = 10
|
FUN_GAR = 10
|
||||||
@ -167,12 +173,12 @@ def fun_repr(fun):
|
|||||||
return {
|
return {
|
||||||
FUN_MAL: 'main_light',
|
FUN_MAL: 'main_light',
|
||||||
FUN_DEL: 'desk_light',
|
FUN_DEL: 'desk_light',
|
||||||
FUN_FLL: 'floorlamp', # TODO: -> floor_light
|
FUN_FLL: 'floor_light',
|
||||||
FUN_BLD: 'bed_light_di',
|
FUN_BLD: 'bed_light_di',
|
||||||
FUN_BLM: 'bed_light_ma',
|
FUN_BLM: 'bed_light_ma',
|
||||||
FUN_HEA: 'heating_valve', # TODO: -> heating
|
FUN_HEA: 'heating_valve',
|
||||||
FUN_MPP: 'powerplug',
|
FUN_MPP: 'powerplug',
|
||||||
FUN_CTR: 'input_device',
|
FUN_INP: 'input_device',
|
||||||
FUN_CIR: 'circulation_pump',
|
FUN_CIR: 'circulation_pump',
|
||||||
FUN_GAR: 'garland',
|
FUN_GAR: 'garland',
|
||||||
FUN_XTR: 'xmas-tree',
|
FUN_XTR: 'xmas-tree',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user