fhem.py 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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. ( "level_download_min",
  76. Tuple(
  77. title = _("Level for speedtest download "),
  78. help = _("You can adjust the levels before this service goes into warning/critical. Set to 0 to disable."),
  79. elements = [
  80. Percentage(title = _("Warning at"), unit = "Mbit/s", default_value = 10),
  81. Percentage(title = _("Critical at"), unit = "Mbit/s", default_value = 8),
  82. ]
  83. )),
  84. ( "level_upload_min",
  85. Tuple(
  86. title = _("Level for speedtest upload"),
  87. help = _("You can adjust the levels before this service goes into warning/critical. Set to 0 to disable."),
  88. elements = [
  89. Percentage(title = _("Warning at"), unit = "Mbit/s", default_value = 1.5),
  90. Percentage(title = _("Critical at"), unit = "Mbit/s", default_value = 1),
  91. ]
  92. )),
  93. ( "level_ping",
  94. Tuple(
  95. title = _("Level for speedtest ping"),
  96. help = _("You can adjust the levels before this service goes into warning/critical. Set to 0 to disable."),
  97. elements = [
  98. Percentage(title = _("Warning at"), unit = "ms", default_value = 100),
  99. Percentage(title = _("Critical at"), unit = "ms", default_value = 150),
  100. ]
  101. )),
  102. ("var_state",
  103. Alternative(
  104. title = _('state'),
  105. style = "dropdown",
  106. allow_empty = False,
  107. help = _("Check state of reading 'state' (default: ignore) "),
  108. elements = [
  109. FixedValue(
  110. 'ok',
  111. totext = "ok",
  112. title = _("ok"),
  113. ),
  114. TextAscii(
  115. title = _("custom"),
  116. label = _("custom:"),
  117. size = 50,
  118. ),
  119. ]
  120. )),
  121. ("var_controlMode",
  122. Alternative(
  123. title = _('Control Mode'),
  124. style = "dropdown",
  125. allow_empty = False,
  126. help = _("Check current control mode. (default: ignore)"),
  127. elements = [
  128. FixedValue(
  129. 'auto',
  130. totext = "auto",
  131. title = _("auto"),
  132. ),
  133. FixedValue(
  134. 'manual',
  135. totext = "manual",
  136. title = _("manual"),
  137. ),
  138. FixedValue(
  139. 'boost',
  140. totext = "boost",
  141. title = _("boost"),
  142. ),
  143. FixedValue(
  144. 'day',
  145. totext = "day",
  146. title = _("day"),
  147. ),
  148. FixedValue(
  149. 'night',
  150. totext = "night",
  151. title = _("night"),
  152. ),
  153. TextAscii(
  154. title = _("custom"),
  155. label = _("custom:"),
  156. size = 50,
  157. ),
  158. ]
  159. )),
  160. ("var_alive",
  161. Alternative(
  162. title = _('Alive state'),
  163. style = "dropdown",
  164. allow_empty = False,
  165. help = _("Check state of reading 'alive' on HomeMatic devices (default: ignore) "),
  166. elements = [
  167. FixedValue(
  168. 'alive',
  169. totext = "alive",
  170. title = _("alive"),
  171. ),
  172. FixedValue(
  173. 'dead',
  174. totext = "dead",
  175. title = _("dead"),
  176. ),
  177. TextAscii(
  178. title = _("custom"),
  179. label = _("custom:"),
  180. size = 50,
  181. ),
  182. ]
  183. )),
  184. ("var_contact",
  185. Alternative(
  186. title = _('Contact state'),
  187. style = "dropdown",
  188. allow_empty = False,
  189. help = _("Check state of reading 'contact' (default: ignore) "),
  190. elements = [
  191. FixedValue(
  192. 'open',
  193. totext = "open",
  194. title = _("open"),
  195. ),
  196. FixedValue(
  197. 'closed',
  198. totext = "closed",
  199. title = _("closed"),
  200. ),
  201. TextAscii(
  202. title = _("custom"),
  203. label = _("custom:"),
  204. size = 50,
  205. ),
  206. ]
  207. )),
  208. ("var_btnLock",
  209. Alternative(
  210. title = _('btnLock state'),
  211. style = "dropdown",
  212. allow_empty = False,
  213. help = _("Check state of reading 'btnLock' (default: ignore) "),
  214. elements = [
  215. FixedValue(
  216. 'on',
  217. totext = "on",
  218. title = _("on"),
  219. ),
  220. FixedValue(
  221. 'off',
  222. totext = "off",
  223. title = _("off"),
  224. ),
  225. TextAscii(
  226. title = _("custom"),
  227. label = _("custom:"),
  228. size = 50,
  229. ),
  230. ]
  231. )),
  232. ("var_globalBtnLock",
  233. Alternative(
  234. title = _('globalBtnLock state'),
  235. style = "dropdown",
  236. allow_empty = False,
  237. help = _("Check state of reading 'globalBtnLock' (default: ignore) "),
  238. elements = [
  239. FixedValue(
  240. 'on',
  241. totext = "on",
  242. title = _("on"),
  243. ),
  244. FixedValue(
  245. 'off',
  246. totext = "off",
  247. title = _("off"),
  248. ),
  249. TextAscii(
  250. title = _("custom"),
  251. label = _("custom:"),
  252. size = 50,
  253. ),
  254. ]
  255. )),
  256. ("var_modusBtnLock",
  257. Alternative(
  258. title = _('modusBtnLock state'),
  259. style = "dropdown",
  260. allow_empty = False,
  261. help = _("Check state of reading 'modusBtnLock' (default: ignore) "),
  262. elements = [
  263. FixedValue(
  264. 'on',
  265. totext = "on",
  266. title = _("on"),
  267. ),
  268. FixedValue(
  269. 'off',
  270. totext = "off",
  271. title = _("off"),
  272. ),
  273. TextAscii(
  274. title = _("custom"),
  275. label = _("custom:"),
  276. size = 50,
  277. ),
  278. ]
  279. )),
  280. ],
  281. # optional_keys = False,
  282. ),
  283. forth = lambda v: type(v) == tuple and { "levels" : v } or v,
  284. ),
  285. TextAscii(
  286. title = _("fhem device"),
  287. help = _("Specify the name of the FHEM device, i.e. <tt>eg.bad.heizung</tt>"),
  288. ),
  289. "dict",
  290. )