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.

topic.py 4.1KB

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