fhem.py 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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. ("var_battery",
  104. Alternative(
  105. title = _('State of battery'),
  106. style = "dropdown",
  107. allow_empty = False,
  108. help = _("Check state of reading 'battery' (default: ok) "),
  109. elements = [
  110. FixedValue(
  111. 'ignore',
  112. totext = "ignore",
  113. title = _("ignore"),
  114. ),
  115. TextAscii(
  116. title = _("custom"),
  117. label = _("custom:"),
  118. size = 50,
  119. ),
  120. ]
  121. )),
  122. ( "level_download_min",
  123. Tuple(
  124. title = _("Level for speedtest download "),
  125. help = _("You can adjust the levels before this service goes into warning/critical. Set to 0 to disable."),
  126. elements = [
  127. Percentage(title = _("Warning at"), unit = "Mbit/s", default_value = 10.0),
  128. Percentage(title = _("Critical at"), unit = "Mbit/s", default_value = 8.0),
  129. ]
  130. )),
  131. ( "level_upload_min",
  132. Tuple(
  133. title = _("Level for speedtest upload"),
  134. help = _("You can adjust the levels before this service goes into warning/critical. Set to 0 to disable."),
  135. elements = [
  136. Percentage(title = _("Warning at"), unit = "Mbit/s", default_value = 1.5),
  137. Percentage(title = _("Critical at"), unit = "Mbit/s", default_value = 1.0),
  138. ]
  139. )),
  140. ( "level_ping",
  141. Tuple(
  142. title = _("Level for speedtest ping"),
  143. help = _("You can adjust the levels before this service goes into warning/critical. Set to 0 to disable."),
  144. elements = [
  145. Integer(title = _("Warning at"), unit = "ms", default_value = 100),
  146. Integer(title = _("Critical at"), unit = "ms", default_value = 150),
  147. ]
  148. )),
  149. ("var_state",
  150. Alternative(
  151. title = _('state'),
  152. style = "dropdown",
  153. allow_empty = False,
  154. help = _("Check state of reading 'state' (default: ignore) "),
  155. elements = [
  156. FixedValue(
  157. 'ok',
  158. totext = "ok",
  159. title = _("ok"),
  160. ),
  161. TextAscii(
  162. title = _("custom"),
  163. label = _("custom:"),
  164. size = 50,
  165. ),
  166. ]
  167. )),
  168. ("var_controlMode",
  169. Alternative(
  170. title = _('Control Mode'),
  171. style = "dropdown",
  172. allow_empty = False,
  173. help = _("Check current control mode. (default: ignore)"),
  174. elements = [
  175. FixedValue(
  176. 'auto',
  177. totext = "auto",
  178. title = _("auto"),
  179. ),
  180. FixedValue(
  181. 'manual',
  182. totext = "manual",
  183. title = _("manual"),
  184. ),
  185. FixedValue(
  186. 'boost',
  187. totext = "boost",
  188. title = _("boost"),
  189. ),
  190. FixedValue(
  191. 'day',
  192. totext = "day",
  193. title = _("day"),
  194. ),
  195. FixedValue(
  196. 'night',
  197. totext = "night",
  198. title = _("night"),
  199. ),
  200. TextAscii(
  201. title = _("custom"),
  202. label = _("custom:"),
  203. size = 50,
  204. ),
  205. ]
  206. )),
  207. ("var_alive",
  208. Alternative(
  209. title = _('Alive state'),
  210. style = "dropdown",
  211. allow_empty = False,
  212. help = _("Check state of reading 'alive' on HomeMatic devices (default: ignore) "),
  213. elements = [
  214. FixedValue(
  215. 'alive',
  216. totext = "alive",
  217. title = _("alive"),
  218. ),
  219. FixedValue(
  220. 'dead',
  221. totext = "dead",
  222. title = _("dead"),
  223. ),
  224. TextAscii(
  225. title = _("custom"),
  226. label = _("custom:"),
  227. size = 50,
  228. ),
  229. ]
  230. )),
  231. ("var_contact",
  232. Alternative(
  233. title = _('Contact state'),
  234. style = "dropdown",
  235. allow_empty = False,
  236. help = _("Check state of reading 'contact' (default: ignore) "),
  237. elements = [
  238. FixedValue(
  239. 'open',
  240. totext = "open",
  241. title = _("open"),
  242. ),
  243. FixedValue(
  244. 'closed',
  245. totext = "closed",
  246. title = _("closed"),
  247. ),
  248. TextAscii(
  249. title = _("custom"),
  250. label = _("custom:"),
  251. size = 50,
  252. ),
  253. ]
  254. )),
  255. ("var_btnLock",
  256. Alternative(
  257. title = _('btnLock state'),
  258. style = "dropdown",
  259. allow_empty = False,
  260. help = _("Check state of reading 'btnLock' (default: ignore) "),
  261. elements = [
  262. FixedValue(
  263. 'on',
  264. totext = "on",
  265. title = _("on"),
  266. ),
  267. FixedValue(
  268. 'off',
  269. totext = "off",
  270. title = _("off"),
  271. ),
  272. TextAscii(
  273. title = _("custom"),
  274. label = _("custom:"),
  275. size = 50,
  276. ),
  277. ]
  278. )),
  279. ("var_globalBtnLock",
  280. Alternative(
  281. title = _('globalBtnLock state'),
  282. style = "dropdown",
  283. allow_empty = False,
  284. help = _("Check state of reading 'globalBtnLock' (default: ignore) "),
  285. elements = [
  286. FixedValue(
  287. 'on',
  288. totext = "on",
  289. title = _("on"),
  290. ),
  291. FixedValue(
  292. 'off',
  293. totext = "off",
  294. title = _("off"),
  295. ),
  296. TextAscii(
  297. title = _("custom"),
  298. label = _("custom:"),
  299. size = 50,
  300. ),
  301. ]
  302. )),
  303. ("var_modusBtnLock",
  304. Alternative(
  305. title = _('modusBtnLock state'),
  306. style = "dropdown",
  307. allow_empty = False,
  308. help = _("Check state of reading 'modusBtnLock' (default: ignore) "),
  309. elements = [
  310. FixedValue(
  311. 'on',
  312. totext = "on",
  313. title = _("on"),
  314. ),
  315. FixedValue(
  316. 'off',
  317. totext = "off",
  318. title = _("off"),
  319. ),
  320. TextAscii(
  321. title = _("custom"),
  322. label = _("custom:"),
  323. size = 50,
  324. ),
  325. ]
  326. )),
  327. ("var_RGB_color",
  328. Alternative(
  329. title = _('RGB color'),
  330. style = "dropdown",
  331. allow_empty = False,
  332. help = _("Check state of reading 'RGB' (without #)"),
  333. elements = [
  334. FixedValue(
  335. 'FFFFFF',
  336. totext = "white",
  337. title = _("white"),
  338. ),
  339. TextAscii(
  340. title = _("custom"),
  341. label = _("custom:"),
  342. size = 6,
  343. ),
  344. ]
  345. )),
  346. ("var_brightness",
  347. Alternative(
  348. title = _('light brightness'),
  349. style = "dropdown",
  350. allow_empty = False,
  351. help = _("Check state of reading 'brightness' (default: ignore) "),
  352. elements = [
  353. FixedValue(
  354. '100',
  355. totext = "100%",
  356. title = _("100%"),
  357. ),
  358. FixedValue(
  359. '0',
  360. totext = "0%",
  361. title = _("0%"),
  362. ),
  363. TextAscii(
  364. title = _("custom"),
  365. label = _("custom:"),
  366. size = 3,
  367. ),
  368. ]
  369. )),
  370. ],
  371. # optional_keys = False,
  372. ),
  373. forth = lambda v: type(v) == tuple and { "levels" : v } or v,
  374. ),
  375. TextAscii(
  376. title = _("fhem device"),
  377. help = _("Specify the name of the FHEM device, i.e. <tt>eg.bad.heizung</tt>"),
  378. ),
  379. "dict",
  380. )