Device definitions and intialisation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. from collections import UserString
  2. #
  3. # Device TYpe definitions
  4. #
  5. DTY_SHY_SW1 = 1
  6. """ Shelly """
  7. DTY_TLI_Sxx = 2
  8. """ Tradfri Light (Switching only) """
  9. DTY_TLI_SBx = 3
  10. """ Tradfri Light (Switching and Brightnes) """
  11. DTY_TLI_SBT = 4
  12. """ Tradfri Light (Switching, Brightnes and Colortemperature) """
  13. DTY_TIN_5xx = 5
  14. """ Tradfri Input Device (5 Buttons) """
  15. DTY_LLI_SBT = 6
  16. """ Livarno Light (Switching, Brightnes and Colortemperature) """
  17. DTY_BVL_xxx = 7
  18. """ Brennenstuhl Heatingvalve """
  19. DTY_SPP_SW1 = 8
  20. """ Silvercrest Powerplug """
  21. DTY_SMS_xxx = 9
  22. """ Silvercrest Motion Sensor """
  23. DTY_MPP_4xx = 10
  24. """ My Powerplug (4 plugs) """
  25. DTY_MAS_xxx = 11
  26. """ My Audio status (MPD) """
  27. DTY_MRE_xxx = 12
  28. """ My Remote control """
  29. DTY_MAM_THP = 13
  30. """ My Ambient Information (Temperature, Humidity, Pressure)"""
  31. #
  32. # Source Transmission Group
  33. #
  34. STG_ZGW = 1
  35. """ Zigbee ground floor west """
  36. STG_ZFW = 2
  37. """ Zigbee first floor west """
  38. STG_ZFE = 3
  39. """ Zigbee first floor east """
  40. STG_SHE = 4
  41. """ Shellies """
  42. STG_MYA = 5
  43. """ My Applications """
  44. #
  45. # LOCation
  46. #
  47. LOC_GFW = 1
  48. """ Grounf floor west """
  49. LOC_GFE = 2
  50. """ Ground floor east """
  51. LOC_STW = 3
  52. """ Stairway """
  53. LOC_FFW = 4
  54. """ First floor west """
  55. LOC_FFE = 5
  56. """ First floor east """
  57. LOC_STW = 6
  58. """ Stairways """
  59. LOC_GAR = 7
  60. #
  61. # ROOms
  62. #
  63. ROO_DIN = 1
  64. """ Diningroom """
  65. ROO_KIT = 2
  66. """ Kitchen """
  67. ROO_LIV = 3
  68. """ Livingroom """
  69. ROO_FLO = 4
  70. """ Floor """
  71. ROO_SLP = 5
  72. """ Sleep """
  73. ROO_BAT = 6
  74. """ Bath """
  75. ROO_DIR = 7
  76. """ Dirk """
  77. ROO_MAR = 8
  78. """ Marion """
  79. ROO_JUL = 9
  80. """ Julian """
  81. ROO_STG = 10
  82. """ ground floor """
  83. ROO_STF = 11
  84. """ first floor """
  85. ROO_GAR = 12
  86. """ garden """
  87. #
  88. # FUNctions
  89. #
  90. FUN_MAL = 1
  91. """ Main Light """
  92. FUN_DEL = 2
  93. """ Desk Light """
  94. FUN_FLL = 3
  95. """ Floor Light """
  96. FUN_BLD = 4
  97. """ Bed Light Dirk """
  98. FUN_BLM = 5
  99. """ Bed Light Marion """
  100. FUN_HEA = 6
  101. """ Heating """
  102. FUN_MPP = 7
  103. """ Multiple Powerplugs """
  104. FUN_INP = 8
  105. """ Input Device """
  106. FUN_CIR = 9
  107. """ Circulation Pump """
  108. FUN_GAR = 10
  109. """ Garland """
  110. FUN_XTR = 11
  111. """ X-Mas Tree """
  112. FUN_XST = 12
  113. """ X-Mas Star """
  114. FUN_MSE = 13
  115. """ Motion Sensor """
  116. FUN_RCA = 14
  117. """ Remote Control Amplifier """
  118. FUN_RCC = 15
  119. """ Remote Control CD-Player """
  120. FUN_ASS = 16
  121. """ Audio status spotify """
  122. FUN_ASM = 17
  123. """ Audio status mpd """
  124. FUN_ASB = 18
  125. """ Audio status bluetooth """
  126. FUN_DCK = 19
  127. """ Docking Station """
  128. FUN_AMB = 20
  129. """ Ambient information """
  130. FUN_REP = 21
  131. """" Repeater suppla """
  132. FUN_WLI = 22
  133. """ Wardrobe light """
  134. class topic_by_props(UserString):
  135. def __init__(self, stg, loc, roo, fun):
  136. UserString.__init__(self, '/'.join([self.__stg_repr__(stg), self.__loc_repr__(loc), self.__roo_repr__(roo), self.__fun_repr__(fun)]))
  137. def __stg_repr__(self, stg):
  138. return {
  139. STG_ZGW: 'zigbee_gfw',
  140. STG_ZFW: 'zigbee_ffw',
  141. STG_ZFE: 'zigbee_ffe',
  142. STG_SHE: 'shellies',
  143. STG_MYA: 'my_apps',
  144. }.get(stg)
  145. def __loc_repr__(self, loc):
  146. return {
  147. LOC_GFW: 'gfw',
  148. LOC_GFE: 'gfe',
  149. LOC_STW: 'stw',
  150. LOC_FFW: 'ffw',
  151. LOC_FFE: 'ffe',
  152. LOC_STW: 'stw',
  153. LOC_GAR: 'gar',
  154. }.get(loc)
  155. def __roo_repr__(self, roo):
  156. return {
  157. ROO_DIN: 'diningroom',
  158. ROO_KIT: 'kitchen',
  159. ROO_LIV: 'livingroom',
  160. ROO_FLO: 'floor',
  161. ROO_SLP: 'sleep',
  162. ROO_BAT: 'bath',
  163. ROO_DIR: 'dirk',
  164. ROO_MAR: 'marion',
  165. ROO_JUL: 'julian',
  166. ROO_STG: 'groundfloor',
  167. ROO_STF: 'firstfloor',
  168. ROO_GAR: 'garden',
  169. }.get(roo)
  170. def __fun_repr__(self, fun):
  171. return {
  172. FUN_MAL: 'main_light',
  173. FUN_DEL: 'desk_light',
  174. FUN_FLL: 'floor_light',
  175. FUN_BLD: 'bed_light_di',
  176. FUN_BLM: 'bed_light_ma',
  177. FUN_HEA: 'heating_valve',
  178. FUN_MPP: 'powerplug',
  179. FUN_INP: 'input_device',
  180. FUN_DCK: 'dock',
  181. FUN_CIR: 'circulation_pump',
  182. FUN_GAR: 'garland',
  183. FUN_XTR: 'xmas-tree',
  184. FUN_XST: 'xmas-star',
  185. FUN_MSE: 'motion_sensor',
  186. FUN_RCA: 'remote_ctrl/RAS5',
  187. FUN_RCC: 'remote_ctrl/EUR642100',
  188. FUN_ASS: 'audio_status_spotify',
  189. FUN_ASM: 'audio_status_mpd',
  190. FUN_ASB: 'audio_status_bt',
  191. FUN_AMB: 'ambient',
  192. FUN_REP: 'repeater',
  193. FUN_WLI: 'wardrobe_light',
  194. }.get(fun)