|
@@ -135,53 +135,13 @@ FUN_DCK = 19
|
135
|
135
|
|
136
|
136
|
class topic_by_props(UserString):
|
137
|
137
|
def __init__(self, stg, loc, roo, fun):
|
138
|
|
- if stg in [STG_ZFE, STG_ZFW, STG_ZGW]:
|
139
|
|
-
|
140
|
|
- topic = '/'.join([
|
141
|
|
- self.__stg_repr__(stg),
|
142
|
|
- self.__roo_repr__(roo),
|
143
|
|
- self.__fun_repr__(fun)
|
144
|
|
- ])
|
145
|
|
- else:
|
146
|
|
- topic = '/'.join([
|
147
|
|
- self.__stg_repr__(stg),
|
148
|
|
- self.__loc_repr__(loc),
|
149
|
|
- self.__roo_repr__(roo),
|
150
|
|
- self.__fun_repr__(fun)
|
151
|
|
- ])
|
152
|
|
-
|
153
|
|
- UserString.__init__(self, self.__tmp_old_topics__(stg, loc, roo, fun) or topic)
|
154
|
|
-
|
155
|
|
- def __tmp_old_topics__(self, stg, loc, roo, fun):
|
156
|
|
-
|
157
|
|
- if stg == STG_MYA and loc == LOC_GFW and roo == ROO_DIR and fun == FUN_RCA:
|
158
|
|
- return "my_apps/gfw/dirk/remote/RAS5"
|
159
|
|
- elif stg == STG_MYA and loc == LOC_GFW and roo == ROO_DIR and fun == FUN_ASS:
|
160
|
|
- return "my_apps/gfw/dirk/hifi/spotify"
|
161
|
|
- elif stg == STG_MYA and loc == LOC_GFW and roo == ROO_DIR and fun == FUN_ASM:
|
162
|
|
- return "my_apps/gfw/dirk/hifi/mpd"
|
163
|
|
- elif stg == STG_MYA and loc == LOC_GFW and roo == ROO_DIR and fun == FUN_ASB:
|
164
|
|
- return "my_apps/gfw/dirk/hifi/btaudio"
|
165
|
|
- elif stg == STG_ZFE and loc == LOC_FFE and roo == ROO_DIN and fun == FUN_FLL:
|
166
|
|
- return "zigbee/ffe/diningroom/powerplug_floorlamp"
|
167
|
|
- elif stg == STG_ZFE and loc == LOC_FFE and roo == ROO_LIV and fun == FUN_FLL:
|
168
|
|
- return "zigbee/ffe/livingroom/floorlamp"
|
169
|
|
- elif stg == STG_ZFE and loc == LOC_FFE and roo == ROO_LIV and fun == FUN_XTR:
|
170
|
|
- return "zigbee/ffe/livingroom/powerplug_xmas-tree"
|
171
|
|
- elif stg == STG_ZFE and loc == LOC_FFE and roo == ROO_LIV and fun == FUN_XST:
|
172
|
|
- return "zigbee/ffe/livingroom/powerplug_xmas-star"
|
173
|
|
- elif stg == STG_SHE and loc == LOC_STW and roo == ROO_STF and fun == FUN_MAL:
|
174
|
|
- return "shellies/stw/stairway/main_light"
|
175
|
|
- elif stg == STG_ZFE and loc == LOC_STW and roo == ROO_STF and fun == FUN_MSE:
|
176
|
|
- return "zigbee/ffe/stairway/motion_sensor_ff"
|
177
|
|
- elif stg == STG_ZGW and loc == LOC_STW and roo == ROO_STG and fun == FUN_MSE:
|
178
|
|
- return "zigbee/gfw/stairway/motion_sensor_gf"
|
|
138
|
+ UserString.__init__(self, '/'.join([self.__stg_repr__(stg), self.__loc_repr__(loc), self.__roo_repr__(roo), self.__fun_repr__(fun)]))
|
179
|
139
|
|
180
|
140
|
def __stg_repr__(self, stg):
|
181
|
141
|
return {
|
182
|
|
- STG_ZGW: 'zigbee/gfw',
|
183
|
|
- STG_ZFW: 'zigbee/ffw',
|
184
|
|
- STG_ZFE: 'zigbee/ffe',
|
|
142
|
+ STG_ZGW: 'zigbee_gfw',
|
|
143
|
+ STG_ZFW: 'zigbee_ffw',
|
|
144
|
+ STG_ZFE: 'zigbee_ffe',
|
185
|
145
|
STG_SHE: 'shellies',
|
186
|
146
|
STG_MYA: 'my_apps',
|
187
|
147
|
}.get(stg)
|