fhem.py 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. #!/usr/bin/python
  2. # -*- encoding: utf-8; py-indent-offset: 4 -*-
  3. # Rules for configuring parameters of check fhem
  4. #subgroup_networking = _("Networking")
  5. register_check_parameters(
  6. subgroup_environment,
  7. "fhem",
  8. _("FHEM"),
  9. Transform(
  10. Dictionary(
  11. elements = [
  12. ( "level_temperature_max",
  13. Tuple(
  14. help = _("You can adjust the levels before this service goes into warning/critical. Set to 1000 to disable."),
  15. title = _("Upper Temperature Levels"),
  16. elements = [
  17. Integer(title = _("Warning at"), unit = u"°C", default_value = 26),
  18. Integer(title = _("Critical at"), unit = u"°C", default_value = 30),
  19. ]
  20. )),
  21. ( "level_temperature_min",
  22. Tuple(
  23. title = _("Lower Temperature Levels"),
  24. help = _("You can adjust the levels before this service goes into warning/critical. Set to -1000 to disable."),
  25. elements = [
  26. Integer(title = _("Warning below"), unit = u"°C", default_value = 0),
  27. Integer(title = _("Critical below"), unit = u"°C", default_value = -10),
  28. ]
  29. )),
  30. # ( "output_unit",
  31. # DropdownChoice(
  32. # title = _("Display values in "),
  33. # choices = [
  34. # ( "c", _("Celsius") ),
  35. # ( "f", _("Fahrenheit") ),
  36. # ( "k", _("Kelvin") ),
  37. # ]
  38. # )),
  39. ( "level_humidity_max",
  40. Tuple(
  41. help = _("You can adjust the levels before this service goes into warning/critical. Set to 1000 to disable."),
  42. title = _("Upper huminity levels"),
  43. elements = [
  44. Integer(title = _("Warning at"), unit = u"%", default_value = 70),
  45. Integer(title = _("Critical at"), unit = u"%", default_value = 80),
  46. ]
  47. )),
  48. ( "level_humidity_min",
  49. Tuple(
  50. title = _("Lower huminity levels"),
  51. help = _("You can adjust the levels before this service goes into warning/critical. Set to -1000 to disable."),
  52. elements = [
  53. Integer(title = _("Warning below"), unit = u"%", default_value = 50),
  54. Integer(title = _("Critical below"), unit = u"%", default_value = 45),
  55. ]
  56. )),
  57. ( "level_data_age",
  58. Tuple(
  59. title = _("Time left until data becoming obsolet."),
  60. help = _("Time before data becoming obsolete. Set to 0 to disable."),
  61. elements = [
  62. Integer(title = _("Warning older than"), unit = "minutes", default_value = 30),
  63. Integer(title = _("Critical older than"), unit = "minutes", default_value = 90),
  64. ]
  65. )),
  66. ( "level_batteryLevel_min",
  67. Tuple(
  68. title = _("Level for batterie voltage"),
  69. help = _("You can adjust the levels before this service goes into warning/critical. Set to 0 to disable."),
  70. elements = [
  71. Percentage(title = _("Warning at"), unit = "V", default_value = 2.3),
  72. Percentage(title = _("Critical at"), unit = "V", default_value = 2.1),
  73. ]
  74. )),
  75. ("var_controlMode",
  76. Alternative(
  77. title = _('Control Mode'),
  78. style = "dropdown",
  79. allow_empty = False,
  80. help = _("Check current control mode. (default: ignore)"),
  81. elements = [
  82. FixedValue(
  83. 'auto',
  84. totext = "auto",
  85. title = _("auto"),
  86. ),
  87. FixedValue(
  88. 'manual',
  89. totext = "manual",
  90. title = _("manual"),
  91. ),
  92. FixedValue(
  93. 'boost',
  94. totext = "boost",
  95. title = _("boost"),
  96. ),
  97. FixedValue(
  98. 'day',
  99. totext = "day",
  100. title = _("day"),
  101. ),
  102. FixedValue(
  103. 'night',
  104. totext = "night",
  105. title = _("night"),
  106. ),
  107. TextAscii(
  108. title = _("custom"),
  109. label = _("custom:"),
  110. size = 50,
  111. ),
  112. ]
  113. )),
  114. ("var_alive",
  115. Alternative(
  116. title = _('Alive state'),
  117. style = "dropdown",
  118. allow_empty = False,
  119. help = _("Check state of reading 'alive' on HomeMatic devices (default: ignore) "),
  120. elements = [
  121. FixedValue(
  122. 'alive',
  123. totext = "alive",
  124. title = _("alive"),
  125. ),
  126. FixedValue(
  127. 'dead',
  128. totext = "dead",
  129. title = _("dead"),
  130. ),
  131. TextAscii(
  132. title = _("custom"),
  133. label = _("custom:"),
  134. size = 50,
  135. ),
  136. ]
  137. )),
  138. ("var_contact",
  139. Alternative(
  140. title = _('Contact state'),
  141. style = "dropdown",
  142. allow_empty = False,
  143. help = _("Check state of reading 'contact' (default: ignore) "),
  144. elements = [
  145. FixedValue(
  146. 'open',
  147. totext = "open",
  148. title = _("open"),
  149. ),
  150. FixedValue(
  151. 'closed',
  152. totext = "closed",
  153. title = _("closed"),
  154. ),
  155. TextAscii(
  156. title = _("custom"),
  157. label = _("custom:"),
  158. size = 50,
  159. ),
  160. ]
  161. )),
  162. ("var_btnLock",
  163. Alternative(
  164. title = _('btnLock state'),
  165. style = "dropdown",
  166. allow_empty = False,
  167. help = _("Check state of reading 'btnLock' (default: ignore) "),
  168. elements = [
  169. FixedValue(
  170. 'on',
  171. totext = "on",
  172. title = _("on"),
  173. ),
  174. FixedValue(
  175. 'off',
  176. totext = "off",
  177. title = _("off"),
  178. ),
  179. TextAscii(
  180. title = _("custom"),
  181. label = _("custom:"),
  182. size = 50,
  183. ),
  184. ]
  185. )),
  186. ("var_globalBtnLock",
  187. Alternative(
  188. title = _('globalBtnLock state'),
  189. style = "dropdown",
  190. allow_empty = False,
  191. help = _("Check state of reading 'globalBtnLock' (default: ignore) "),
  192. elements = [
  193. FixedValue(
  194. 'on',
  195. totext = "on",
  196. title = _("on"),
  197. ),
  198. FixedValue(
  199. 'off',
  200. totext = "off",
  201. title = _("off"),
  202. ),
  203. TextAscii(
  204. title = _("custom"),
  205. label = _("custom:"),
  206. size = 50,
  207. ),
  208. ]
  209. )),
  210. ("var_modusBtnLock",
  211. Alternative(
  212. title = _('modusBtnLock state'),
  213. style = "dropdown",
  214. allow_empty = False,
  215. help = _("Check state of reading 'modusBtnLock' (default: ignore) "),
  216. elements = [
  217. FixedValue(
  218. 'on',
  219. totext = "on",
  220. title = _("on"),
  221. ),
  222. FixedValue(
  223. 'off',
  224. totext = "off",
  225. title = _("off"),
  226. ),
  227. TextAscii(
  228. title = _("custom"),
  229. label = _("custom:"),
  230. size = 50,
  231. ),
  232. ]
  233. )),
  234. ],
  235. # optional_keys = False,
  236. ),
  237. forth = lambda v: type(v) == tuple and { "levels" : v } or v,
  238. ),
  239. TextAscii(
  240. title = _("fhem device"),
  241. help = _("Specify the name of the FHEM device, i.e. <tt>eg.bad.heizung</tt>"),
  242. ),
  243. "dict",
  244. )