fhem.py 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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_dewpoint_max",
  58. Tuple(
  59. title = _("diff to temperatur (exp. 17°C (dewp) vs 20°C(temp)"),
  60. help = _("You can adjust the levels before this service goes into warning/critical. Set to 999 to disable."),
  61. elements = [
  62. Integer(title = _("Warning below"), unit = u"%", default_value = 3),
  63. Integer(title = _("Critical below"), unit = u"%", default_value = 1),
  64. ]
  65. )),
  66. ("var_dewpoint_override",
  67. Alternative(
  68. title = _('state'),
  69. style = "dropdown",
  70. allow_empty = False,
  71. help = _("don't alert humidity if dewpoint given. (default: true)"),
  72. elements = [
  73. FixedValue(
  74. 'true',
  75. totext = "true",
  76. title = _("true"),
  77. ),
  78. FixedValue(
  79. 'false',
  80. totext = "false",
  81. title = _("false"),
  82. ),
  83. ]
  84. )),
  85. ( "level_data_age",
  86. Tuple(
  87. title = _("Time left until data becoming obsolet."),
  88. help = _("Time before data becoming obsolete. Set to 0 to disable."),
  89. elements = [
  90. Integer(title = _("Warning older than"), unit = "minutes", default_value = 30),
  91. Integer(title = _("Critical older than"), unit = "minutes", default_value = 90),
  92. ]
  93. )),
  94. ( "level_batteryLevel_min",
  95. Tuple(
  96. title = _("Level for batterie voltage"),
  97. help = _("You can adjust the levels before this service goes into warning/critical. Set to 0 to disable."),
  98. elements = [
  99. Percentage(title = _("Warning at"), unit = "V", default_value = 2.3),
  100. Percentage(title = _("Critical at"), unit = "V", default_value = 2.1),
  101. ]
  102. )),
  103. ( "level_download_min",
  104. Tuple(
  105. title = _("Level for speedtest download "),
  106. help = _("You can adjust the levels before this service goes into warning/critical. Set to 0 to disable."),
  107. elements = [
  108. Percentage(title = _("Warning at"), unit = "Mbit/s", default_value = 10.0),
  109. Percentage(title = _("Critical at"), unit = "Mbit/s", default_value = 8.0),
  110. ]
  111. )),
  112. ( "level_upload_min",
  113. Tuple(
  114. title = _("Level for speedtest upload"),
  115. help = _("You can adjust the levels before this service goes into warning/critical. Set to 0 to disable."),
  116. elements = [
  117. Percentage(title = _("Warning at"), unit = "Mbit/s", default_value = 1.5),
  118. Percentage(title = _("Critical at"), unit = "Mbit/s", default_value = 1.0),
  119. ]
  120. )),
  121. ( "level_ping",
  122. Tuple(
  123. title = _("Level for speedtest ping"),
  124. help = _("You can adjust the levels before this service goes into warning/critical. Set to 0 to disable."),
  125. elements = [
  126. Integer(title = _("Warning at"), unit = "ms", default_value = 100),
  127. Integer(title = _("Critical at"), unit = "ms", default_value = 150),
  128. ]
  129. )),
  130. ("var_state",
  131. Alternative(
  132. title = _('state'),
  133. style = "dropdown",
  134. allow_empty = False,
  135. help = _("Check state of reading 'state' (default: ignore) "),
  136. elements = [
  137. FixedValue(
  138. 'ok',
  139. totext = "ok",
  140. title = _("ok"),
  141. ),
  142. TextAscii(
  143. title = _("custom"),
  144. label = _("custom:"),
  145. size = 50,
  146. ),
  147. ]
  148. )),
  149. ("var_controlMode",
  150. Alternative(
  151. title = _('Control Mode'),
  152. style = "dropdown",
  153. allow_empty = False,
  154. help = _("Check current control mode. (default: ignore)"),
  155. elements = [
  156. FixedValue(
  157. 'auto',
  158. totext = "auto",
  159. title = _("auto"),
  160. ),
  161. FixedValue(
  162. 'manual',
  163. totext = "manual",
  164. title = _("manual"),
  165. ),
  166. FixedValue(
  167. 'boost',
  168. totext = "boost",
  169. title = _("boost"),
  170. ),
  171. FixedValue(
  172. 'day',
  173. totext = "day",
  174. title = _("day"),
  175. ),
  176. FixedValue(
  177. 'night',
  178. totext = "night",
  179. title = _("night"),
  180. ),
  181. TextAscii(
  182. title = _("custom"),
  183. label = _("custom:"),
  184. size = 50,
  185. ),
  186. ]
  187. )),
  188. ("var_alive",
  189. Alternative(
  190. title = _('Alive state'),
  191. style = "dropdown",
  192. allow_empty = False,
  193. help = _("Check state of reading 'alive' on HomeMatic devices (default: ignore) "),
  194. elements = [
  195. FixedValue(
  196. 'alive',
  197. totext = "alive",
  198. title = _("alive"),
  199. ),
  200. FixedValue(
  201. 'dead',
  202. totext = "dead",
  203. title = _("dead"),
  204. ),
  205. TextAscii(
  206. title = _("custom"),
  207. label = _("custom:"),
  208. size = 50,
  209. ),
  210. ]
  211. )),
  212. ("var_contact",
  213. Alternative(
  214. title = _('Contact state'),
  215. style = "dropdown",
  216. allow_empty = False,
  217. help = _("Check state of reading 'contact' (default: ignore) "),
  218. elements = [
  219. FixedValue(
  220. 'open',
  221. totext = "open",
  222. title = _("open"),
  223. ),
  224. FixedValue(
  225. 'closed',
  226. totext = "closed",
  227. title = _("closed"),
  228. ),
  229. TextAscii(
  230. title = _("custom"),
  231. label = _("custom:"),
  232. size = 50,
  233. ),
  234. ]
  235. )),
  236. ("var_btnLock",
  237. Alternative(
  238. title = _('btnLock state'),
  239. style = "dropdown",
  240. allow_empty = False,
  241. help = _("Check state of reading 'btnLock' (default: ignore) "),
  242. elements = [
  243. FixedValue(
  244. 'on',
  245. totext = "on",
  246. title = _("on"),
  247. ),
  248. FixedValue(
  249. 'off',
  250. totext = "off",
  251. title = _("off"),
  252. ),
  253. TextAscii(
  254. title = _("custom"),
  255. label = _("custom:"),
  256. size = 50,
  257. ),
  258. ]
  259. )),
  260. ("var_globalBtnLock",
  261. Alternative(
  262. title = _('globalBtnLock state'),
  263. style = "dropdown",
  264. allow_empty = False,
  265. help = _("Check state of reading 'globalBtnLock' (default: ignore) "),
  266. elements = [
  267. FixedValue(
  268. 'on',
  269. totext = "on",
  270. title = _("on"),
  271. ),
  272. FixedValue(
  273. 'off',
  274. totext = "off",
  275. title = _("off"),
  276. ),
  277. TextAscii(
  278. title = _("custom"),
  279. label = _("custom:"),
  280. size = 50,
  281. ),
  282. ]
  283. )),
  284. ("var_modusBtnLock",
  285. Alternative(
  286. title = _('modusBtnLock state'),
  287. style = "dropdown",
  288. allow_empty = False,
  289. help = _("Check state of reading 'modusBtnLock' (default: ignore) "),
  290. elements = [
  291. FixedValue(
  292. 'on',
  293. totext = "on",
  294. title = _("on"),
  295. ),
  296. FixedValue(
  297. 'off',
  298. totext = "off",
  299. title = _("off"),
  300. ),
  301. TextAscii(
  302. title = _("custom"),
  303. label = _("custom:"),
  304. size = 50,
  305. ),
  306. ]
  307. )),
  308. ("var_RGB_color",
  309. Alternative(
  310. title = _('RGB color'),
  311. style = "dropdown",
  312. allow_empty = False,
  313. help = _("Check state of reading 'RGB' (without #)"),
  314. elements = [
  315. FixedValue(
  316. 'FFFFFF',
  317. totext = "white",
  318. title = _("white"),
  319. ),
  320. TextAscii(
  321. title = _("custom"),
  322. label = _("custom:"),
  323. size = 6,
  324. ),
  325. ]
  326. )),
  327. ("var_brightness",
  328. Alternative(
  329. title = _('light brightness'),
  330. style = "dropdown",
  331. allow_empty = False,
  332. help = _("Check state of reading 'brightness' (default: ignore) "),
  333. elements = [
  334. FixedValue(
  335. '100',
  336. totext = "100%",
  337. title = _("100%"),
  338. ),
  339. FixedValue(
  340. '0',
  341. totext = "0%",
  342. title = _("0%"),
  343. ),
  344. TextAscii(
  345. title = _("custom"),
  346. label = _("custom:"),
  347. size = 3,
  348. ),
  349. ]
  350. )),
  351. ],
  352. # optional_keys = False,
  353. ),
  354. forth = lambda v: type(v) == tuple and { "levels" : v } or v,
  355. ),
  356. TextAscii(
  357. title = _("fhem device"),
  358. help = _("Specify the name of the FHEM device, i.e. <tt>eg.bad.heizung</tt>"),
  359. ),
  360. "dict",
  361. )