Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.25 KB | None | 0 0
  1. [
  2. {
  3. "id": "a5938ab7.325b38",
  4. "type": "timed-counter",
  5. "z": "77bb0eda.e443e",
  6. "name": "Click counter",
  7. "timelimit": "500",
  8. "timeunit": "1",
  9. "withhold": true,
  10. "fixedtimeout": true,
  11. "pertopic": false,
  12. "x": 430,
  13. "y": 120,
  14. "wires": [
  15. [
  16. "87ad7c15.66f94"
  17. ]
  18. ]
  19. },
  20. {
  21. "id": "a942a51d.22b7d8",
  22. "type": "server-state-changed",
  23. "z": "77bb0eda.e443e",
  24. "name": "Switch guest bedroom",
  25. "server": "2142aba5.430414",
  26. "entityidfilter": "binary_sensor.shelly1_2_switch",
  27. "entityidfiltertype": "exact",
  28. "outputinitially": false,
  29. "state_type": "str",
  30. "haltifstate": "off",
  31. "halt_if_type": "",
  32. "halt_if_compare": "is",
  33. "outputs": 2,
  34. "output_only_on_state_change": true,
  35. "x": 140,
  36. "y": 180,
  37. "wires": [
  38. [
  39. "cd695deb.4ff56"
  40. ],
  41. [
  42. "a5938ab7.325b38",
  43. "cd695deb.4ff56"
  44. ]
  45. ]
  46. },
  47. {
  48. "id": "87ad7c15.66f94",
  49. "type": "switch",
  50. "z": "77bb0eda.e443e",
  51. "name": "How many clicks?",
  52. "property": "count",
  53. "propertyType": "msg",
  54. "rules": [
  55. {
  56. "t": "eq",
  57. "v": "1",
  58. "vt": "str"
  59. },
  60. {
  61. "t": "eq",
  62. "v": "2",
  63. "vt": "str"
  64. },
  65. {
  66. "t": "eq",
  67. "v": "3",
  68. "vt": "str"
  69. }
  70. ],
  71. "checkall": "true",
  72. "repair": false,
  73. "outputs": 3,
  74. "x": 690,
  75. "y": 120,
  76. "wires": [
  77. [
  78. "1cb9a2c6.0fc7cd"
  79. ],
  80. [
  81. "ac449422.082998"
  82. ],
  83. [
  84. "ac449422.082998",
  85. "1cb9a2c6.0fc7cd"
  86. ]
  87. ]
  88. },
  89. {
  90. "id": "1cb9a2c6.0fc7cd",
  91. "type": "api-call-service",
  92. "z": "77bb0eda.e443e",
  93. "name": "toggle main light",
  94. "server": "2142aba5.430414",
  95. "service_domain": "switch",
  96. "service": "toggle",
  97. "data": "{\"entity_id\":\"switch.shelly1_2_relay\"}",
  98. "mergecontext": "",
  99. "output_location": "",
  100. "output_location_type": "none",
  101. "x": 1140,
  102. "y": 80,
  103. "wires": [
  104. []
  105. ]
  106. },
  107. {
  108. "id": "ac449422.082998",
  109. "type": "api-call-service",
  110. "z": "77bb0eda.e443e",
  111. "name": "toggle bed light",
  112. "server": "2142aba5.430414",
  113. "service_domain": "switch",
  114. "service": "toggle",
  115. "data": "{\"entity_id\":\"switch.sonoff_2460\"}",
  116. "mergecontext": "",
  117. "output_location": "",
  118. "output_location_type": "none",
  119. "x": 1140,
  120. "y": 140,
  121. "wires": [
  122. []
  123. ]
  124. },
  125. {
  126. "id": "cd695deb.4ff56",
  127. "type": "change",
  128. "z": "77bb0eda.e443e",
  129. "name": "Add timestamp",
  130. "rules": [
  131. {
  132. "t": "set",
  133. "p": "payload",
  134. "pt": "msg",
  135. "to": "{\t 'state': payload,\t 'timestamp': $millis()\t}",
  136. "tot": "jsonata"
  137. }
  138. ],
  139. "action": "",
  140. "property": "",
  141. "from": "",
  142. "to": "",
  143. "reg": false,
  144. "x": 420,
  145. "y": 280,
  146. "wires": [
  147. [
  148. "54e2cd83.287184"
  149. ]
  150. ]
  151. },
  152. {
  153. "id": "54e2cd83.287184",
  154. "type": "join",
  155. "z": "77bb0eda.e443e",
  156. "name": "",
  157. "mode": "custom",
  158. "build": "object",
  159. "property": "payload",
  160. "propertyType": "msg",
  161. "key": "payload.state",
  162. "joiner": "\\n",
  163. "joinerType": "str",
  164. "accumulate": false,
  165. "timeout": "",
  166. "count": "2",
  167. "reduceRight": false,
  168. "reduceExp": "",
  169. "reduceInit": "",
  170. "reduceInitType": "",
  171. "reduceFixup": "",
  172. "x": 590,
  173. "y": 280,
  174. "wires": [
  175. [
  176. "54c1ed1a.7e8314"
  177. ]
  178. ]
  179. },
  180. {
  181. "id": "54c1ed1a.7e8314",
  182. "type": "change",
  183. "z": "77bb0eda.e443e",
  184. "name": "Process delta",
  185. "rules": [
  186. {
  187. "t": "set",
  188. "p": "threshold",
  189. "pt": "msg",
  190. "to": "1000",
  191. "tot": "num"
  192. },
  193. {
  194. "t": "set",
  195. "p": "delta",
  196. "pt": "msg",
  197. "to": "$lookup(payload, 'off').timestamp - $lookup(payload, 'on').timestamp",
  198. "tot": "jsonata"
  199. },
  200. {
  201. "t": "set",
  202. "p": "payload",
  203. "pt": "msg",
  204. "to": "delta < threshold ? 'short' : 'long'",
  205. "tot": "jsonata"
  206. }
  207. ],
  208. "action": "",
  209. "property": "",
  210. "from": "",
  211. "to": "",
  212. "reg": false,
  213. "x": 760,
  214. "y": 280,
  215. "wires": [
  216. [
  217. "9f5e6aa6.458318"
  218. ]
  219. ]
  220. },
  221. {
  222. "id": "9f5e6aa6.458318",
  223. "type": "switch",
  224. "z": "77bb0eda.e443e",
  225. "name": "long?",
  226. "property": "payload",
  227. "propertyType": "msg",
  228. "rules": [
  229. {
  230. "t": "eq",
  231. "v": "long",
  232. "vt": "str"
  233. }
  234. ],
  235. "checkall": "true",
  236. "repair": false,
  237. "outputs": 1,
  238. "x": 930,
  239. "y": 280,
  240. "wires": [
  241. [
  242. "be460813.6f4aa8",
  243. "efac5498.afc0c8"
  244. ]
  245. ]
  246. },
  247. {
  248. "id": "be460813.6f4aa8",
  249. "type": "api-call-service",
  250. "z": "77bb0eda.e443e",
  251. "name": "Turn all lights off",
  252. "server": "2142aba5.430414",
  253. "service_domain": "switch",
  254. "service": "turn_off",
  255. "data": "{\"entity_id\":\"group.guest_room_lights\"}",
  256. "mergecontext": "",
  257. "output_location": "",
  258. "output_location_type": "none",
  259. "x": 1140,
  260. "y": 280,
  261. "wires": [
  262. []
  263. ]
  264. },
  265. {
  266. "id": "efac5498.afc0c8",
  267. "type": "change",
  268. "z": "77bb0eda.e443e",
  269. "name": "Reset counter",
  270. "rules": [
  271. {
  272. "t": "set",
  273. "p": "reset",
  274. "pt": "msg",
  275. "to": "",
  276. "tot": "str"
  277. }
  278. ],
  279. "action": "",
  280. "property": "",
  281. "from": "",
  282. "to": "",
  283. "reg": false,
  284. "x": 420,
  285. "y": 200,
  286. "wires": [
  287. [
  288. "a5938ab7.325b38"
  289. ]
  290. ]
  291. },
  292. {
  293. "id": "2142aba5.430414",
  294. "type": "server",
  295. "z": "",
  296. "name": "Home Assistant"
  297. }
  298. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement