Device definitions and intialisation
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

props.py 4.0KB

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