devdi: Change to non tmp topics for all existing devices
This commit is contained in:
parent
fc1f86ab5a
commit
4cdab5a4e3
@ -59,12 +59,14 @@ class base(dict):
|
|||||||
logger.warning('Device type %d is not yet implemented. Topic %s will not be supported.', dty, topic)
|
logger.warning('Device type %d is not yet implemented. Topic %s will not be supported.', dty, topic)
|
||||||
else:
|
else:
|
||||||
self[topic] = this_device
|
self[topic] = this_device
|
||||||
|
logger.debug("Added a device type=%s, topic=%s", dty, topic)
|
||||||
else:
|
else:
|
||||||
dg = []
|
dg = []
|
||||||
for i in range(1, num + 1):
|
for i in range(1, num + 1):
|
||||||
device_topic = topic + '_%d' % i
|
device_topic = topic + '_%d' % i
|
||||||
dg.append(get_device(dty, mqtt_client, device_topic))
|
dg.append(get_device(dty, mqtt_client, device_topic))
|
||||||
self[topic] = devices.group(*dg)
|
self[topic] = devices.group(*dg)
|
||||||
|
logger.debug("Added a devicegroup type=%s, topic=%s", dty, topic + '_<num>')
|
||||||
|
|
||||||
def get(self, stg, loc, roo, fun):
|
def get(self, stg, loc, roo, fun):
|
||||||
"""Method to get a device
|
"""Method to get a device
|
||||||
|
48
topic.py
48
topic.py
@ -135,53 +135,13 @@ FUN_DCK = 19
|
|||||||
|
|
||||||
class topic_by_props(UserString):
|
class topic_by_props(UserString):
|
||||||
def __init__(self, stg, loc, roo, fun):
|
def __init__(self, stg, loc, roo, fun):
|
||||||
if stg in [STG_ZFE, STG_ZFW, STG_ZGW]:
|
UserString.__init__(self, '/'.join([self.__stg_repr__(stg), self.__loc_repr__(loc), self.__roo_repr__(roo), self.__fun_repr__(fun)]))
|
||||||
# TODO: Temporary to fit to current implementation
|
|
||||||
topic = '/'.join([
|
|
||||||
self.__stg_repr__(stg),
|
|
||||||
self.__roo_repr__(roo),
|
|
||||||
self.__fun_repr__(fun)
|
|
||||||
])
|
|
||||||
else:
|
|
||||||
topic = '/'.join([
|
|
||||||
self.__stg_repr__(stg),
|
|
||||||
self.__loc_repr__(loc),
|
|
||||||
self.__roo_repr__(roo),
|
|
||||||
self.__fun_repr__(fun)
|
|
||||||
])
|
|
||||||
|
|
||||||
UserString.__init__(self, self.__tmp_old_topics__(stg, loc, roo, fun) or topic)
|
|
||||||
|
|
||||||
def __tmp_old_topics__(self, stg, loc, roo, fun):
|
|
||||||
# TODO: Temporary to fit to current implementation
|
|
||||||
if stg == STG_MYA and loc == LOC_GFW and roo == ROO_DIR and fun == FUN_RCA:
|
|
||||||
return "my_apps/gfw/dirk/remote/RAS5"
|
|
||||||
elif stg == STG_MYA and loc == LOC_GFW and roo == ROO_DIR and fun == FUN_ASS:
|
|
||||||
return "my_apps/gfw/dirk/hifi/spotify"
|
|
||||||
elif stg == STG_MYA and loc == LOC_GFW and roo == ROO_DIR and fun == FUN_ASM:
|
|
||||||
return "my_apps/gfw/dirk/hifi/mpd"
|
|
||||||
elif stg == STG_MYA and loc == LOC_GFW and roo == ROO_DIR and fun == FUN_ASB:
|
|
||||||
return "my_apps/gfw/dirk/hifi/btaudio"
|
|
||||||
elif stg == STG_ZFE and loc == LOC_FFE and roo == ROO_DIN and fun == FUN_FLL:
|
|
||||||
return "zigbee/ffe/diningroom/powerplug_floorlamp"
|
|
||||||
elif stg == STG_ZFE and loc == LOC_FFE and roo == ROO_LIV and fun == FUN_FLL:
|
|
||||||
return "zigbee/ffe/livingroom/floorlamp"
|
|
||||||
elif stg == STG_ZFE and loc == LOC_FFE and roo == ROO_LIV and fun == FUN_XTR:
|
|
||||||
return "zigbee/ffe/livingroom/powerplug_xmas-tree"
|
|
||||||
elif stg == STG_ZFE and loc == LOC_FFE and roo == ROO_LIV and fun == FUN_XST:
|
|
||||||
return "zigbee/ffe/livingroom/powerplug_xmas-star"
|
|
||||||
elif stg == STG_SHE and loc == LOC_STW and roo == ROO_STF and fun == FUN_MAL:
|
|
||||||
return "shellies/stw/stairway/main_light"
|
|
||||||
elif stg == STG_ZFE and loc == LOC_STW and roo == ROO_STF and fun == FUN_MSE:
|
|
||||||
return "zigbee/ffe/stairway/motion_sensor_ff"
|
|
||||||
elif stg == STG_ZGW and loc == LOC_STW and roo == ROO_STG and fun == FUN_MSE:
|
|
||||||
return "zigbee/gfw/stairway/motion_sensor_gf"
|
|
||||||
|
|
||||||
def __stg_repr__(self, stg):
|
def __stg_repr__(self, stg):
|
||||||
return {
|
return {
|
||||||
STG_ZGW: 'zigbee/gfw', # TODO: -> zigbee_gfw
|
STG_ZGW: 'zigbee_gfw',
|
||||||
STG_ZFW: 'zigbee/ffw', # TODO: -> zigbee_ffw
|
STG_ZFW: 'zigbee_ffw',
|
||||||
STG_ZFE: 'zigbee/ffe', # TODO: -> zigbee_ffe
|
STG_ZFE: 'zigbee_ffe',
|
||||||
STG_SHE: 'shellies',
|
STG_SHE: 'shellies',
|
||||||
STG_MYA: 'my_apps',
|
STG_MYA: 'my_apps',
|
||||||
}.get(stg)
|
}.get(stg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user