Advertisement
Guest User

Untitled

a guest
Mar 5th, 2025
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.86 KB | None | 0 0
  1. [
  2. {
  3. "id": "afd3d04528cf5eb1",
  4. "type": "group",
  5. "z": "06d093a44e455a57",
  6. "name": "AE200 Interface",
  7. "style": {
  8. "label": true
  9. },
  10. "nodes": [
  11. "957fcdfcaa073380",
  12. "23449e4aaa4ad337",
  13. "bbc90588f0c1632e",
  14. "e7cc387079689a12",
  15. "074047158cd41451",
  16. "d9d4e69475f10ee0",
  17. "9fcf57953e3cab6f",
  18. "d4c484521d315266",
  19. "f2fb06c469c4ae05",
  20. "bdbf0a8f25f63703",
  21. "4d45f5bb512d6b93",
  22. "064bf80f5d0583a9",
  23. "25406b72b21d984c",
  24. "a02b673b49a5ca66",
  25. "f9d1e2a70f2990bd",
  26. "88e4d9ef86236b0f",
  27. "ab3d2158cf1feec2",
  28. "5ab1e0b5fa9ce97d",
  29. "92080183eec1ef07",
  30. "908f45f4f3fca18a",
  31. "9f0b76bb906c9fb1",
  32. "ff9ea310bc5f7dfe",
  33. "359efa85d3785f3c",
  34. "292a2d3678e64bc3",
  35. "18a0944d01943312",
  36. "5f2595c6be7136c2",
  37. "d3c54ccf89aef8c8",
  38. "aa56d185614cca6f",
  39. "b1529e96e463ee0e",
  40. "e2ee675075332f3e",
  41. "74109a521cf1af56",
  42. "226482e540b69d27",
  43. "33d58eeb2d9b2ba9",
  44. "f190122e9c98fe5c",
  45. "615866257bf8c479",
  46. "44616ffc4f3dbc73",
  47. "290dc8f2945a6a99",
  48. "546bd26ea31e65ca",
  49. "c7653e4292c70726",
  50. "4bd563752b45384c",
  51. "b704ebbbe4c5e9db"
  52. ],
  53. "x": 34,
  54. "y": 19,
  55. "w": 1392,
  56. "h": 562
  57. },
  58. {
  59. "id": "957fcdfcaa073380",
  60. "type": "websocket in",
  61. "z": "06d093a44e455a57",
  62. "g": "afd3d04528cf5eb1",
  63. "name": "AE-200 Web Socket",
  64. "server": "",
  65. "client": "9ee1a86948c818e6",
  66. "x": 150,
  67. "y": 260,
  68. "wires": [
  69. [
  70. "074047158cd41451"
  71. ]
  72. ]
  73. },
  74. {
  75. "id": "23449e4aaa4ad337",
  76. "type": "inject",
  77. "z": "06d093a44e455a57",
  78. "g": "afd3d04528cf5eb1",
  79. "name": "Hourly",
  80. "props": [
  81. {
  82. "p": "payload"
  83. },
  84. {
  85. "p": "topic",
  86. "vt": "str"
  87. }
  88. ],
  89. "repeat": "3600",
  90. "crontab": "",
  91. "once": false,
  92. "onceDelay": "3",
  93. "topic": "",
  94. "payload": "",
  95. "payloadType": "date",
  96. "x": 140,
  97. "y": 100,
  98. "wires": [
  99. [
  100. "bbc90588f0c1632e",
  101. "ff9ea310bc5f7dfe"
  102. ]
  103. ]
  104. },
  105. {
  106. "id": "bbc90588f0c1632e",
  107. "type": "template",
  108. "z": "06d093a44e455a57",
  109. "g": "afd3d04528cf5eb1",
  110. "name": "MnetList",
  111. "field": "payload",
  112. "fieldType": "msg",
  113. "format": "handlebars",
  114. "syntax": "plain",
  115. "template": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<Packet>\n<Command>getRequest</Command>\n<DatabaseManager>\n<ControlGroup>\n<MnetList />\n</ControlGroup>\n</DatabaseManager>\n</Packet>",
  116. "output": "str",
  117. "x": 340,
  118. "y": 100,
  119. "wires": [
  120. [
  121. "e7cc387079689a12"
  122. ]
  123. ]
  124. },
  125. {
  126. "id": "e7cc387079689a12",
  127. "type": "websocket out",
  128. "z": "06d093a44e455a57",
  129. "g": "afd3d04528cf5eb1",
  130. "name": "AE-200 Web Socket",
  131. "server": "",
  132. "client": "9ee1a86948c818e6",
  133. "x": 620,
  134. "y": 140,
  135. "wires": []
  136. },
  137. {
  138. "id": "074047158cd41451",
  139. "type": "xml",
  140. "z": "06d093a44e455a57",
  141. "g": "afd3d04528cf5eb1",
  142. "name": "",
  143. "property": "payload",
  144. "attr": "",
  145. "chr": "",
  146. "x": 330,
  147. "y": 260,
  148. "wires": [
  149. [
  150. "d9d4e69475f10ee0"
  151. ]
  152. ]
  153. },
  154. {
  155. "id": "d9d4e69475f10ee0",
  156. "type": "switch",
  157. "z": "06d093a44e455a57",
  158. "g": "afd3d04528cf5eb1",
  159. "name": "Packet Type",
  160. "property": "payload",
  161. "propertyType": "msg",
  162. "rules": [
  163. {
  164. "t": "jsonata_exp",
  165. "v": "$exists(payload.Packet.DatabaseManager.ControlGroup.MnetList.MnetRecord)",
  166. "vt": "jsonata"
  167. },
  168. {
  169. "t": "jsonata_exp",
  170. "v": "$exists(payload.Packet.DatabaseManager.Mnet)",
  171. "vt": "jsonata"
  172. },
  173. {
  174. "t": "jsonata_exp",
  175. "v": "$exists(payload.Packet.DatabaseManager.SystemData)",
  176. "vt": "jsonata"
  177. },
  178. {
  179. "t": "else"
  180. }
  181. ],
  182. "checkall": "true",
  183. "repair": false,
  184. "outputs": 4,
  185. "x": 350,
  186. "y": 340,
  187. "wires": [
  188. [
  189. "f9d1e2a70f2990bd",
  190. "615866257bf8c479"
  191. ],
  192. [
  193. "92080183eec1ef07",
  194. "f190122e9c98fe5c"
  195. ],
  196. [
  197. "18a0944d01943312"
  198. ],
  199. [
  200. "359efa85d3785f3c"
  201. ]
  202. ]
  203. },
  204. {
  205. "id": "9fcf57953e3cab6f",
  206. "type": "mqtt out",
  207. "z": "06d093a44e455a57",
  208. "g": "afd3d04528cf5eb1",
  209. "name": "Retain",
  210. "topic": "",
  211. "qos": "",
  212. "retain": "true",
  213. "respTopic": "",
  214. "contentType": "",
  215. "userProps": "",
  216. "correl": "",
  217. "expiry": "",
  218. "broker": "188340c12e25adf5",
  219. "x": 790,
  220. "y": 520,
  221. "wires": []
  222. },
  223. {
  224. "id": "d4c484521d315266",
  225. "type": "debug",
  226. "z": "06d093a44e455a57",
  227. "g": "afd3d04528cf5eb1",
  228. "name": "debug 94",
  229. "active": false,
  230. "tosidebar": true,
  231. "console": false,
  232. "tostatus": false,
  233. "complete": "false",
  234. "statusVal": "",
  235. "statusType": "auto",
  236. "x": 800,
  237. "y": 460,
  238. "wires": []
  239. },
  240. {
  241. "id": "f2fb06c469c4ae05",
  242. "type": "function",
  243. "z": "06d093a44e455a57",
  244. "g": "afd3d04528cf5eb1",
  245. "name": "Climate States",
  246. "func": "const fanModeMapping = { \"AUTO\": \"Auto\", \"LOW\": \"Low\", \"MID2\": \"Medium L\", \"MID1\": \"Medium H\", \"HIGH\": \"High\"};\nconst swingModeMapping = { \"HORIZONTAL\": \"Horizontal\", \"MID0\": \"Mid 0\", \"MID1\": \"Mid 1\", \"MID2\": \"Mid 2\", \"VERTICAL\": \"Vertical\", \"SWING\": \"Swing\", \"AUTO\": \"Auto\" };\nconst modeMapping = {\"OFF\": \"off\", \"COOL\": \"cool\", \"DRY\": \"dry\", \"FAN\": \"fan_only\", \"HEAT\": \"heat\", \"AUTO\": \"auto\", \"AUTOCOOL\": \"auto\", \"AUTOHEAT\": \"auto\", \"LC_AUTO\": \"Auto\", \"HEATRECOVERY\": \"Heat Recovery\", \"BYPASS\": \"Bypass\"};\n\nlet packet = msg.payload.Packet.DatabaseManager[0].Mnet;\nlet ae200_cache = global.get(\"ae200_cache\");\n\npacket.forEach(item => {\n let record = item.$\n if (!record.hasOwnProperty(\"Group\")) {return;}\n let cache = ae200_cache[record.Group];\n \n var baseTopic = \"ae200/mnet_\" + record.Group;\n\n // If we're dealing with AC power or mode state...\n if (cache.Model == \"IC\" && (record.hasOwnProperty(\"Drive\") || record.hasOwnProperty(\"Mode\"))) {\n\n // Mode status message - compute from drive and mode...\n let powerstate = cache.Drive;\n let modestate = cache.Mode;\n\n // Use latest if present...\n if (record.hasOwnProperty(\"Drive\")) { powerstate = record[\"Drive\"]; }\n if (record.hasOwnProperty(\"Mode\")) { modestate = record[\"Mode\"]; }\n\n if (powerstate != \"ON\") {\n node.send({\n payload: \"off\",\n topic: `${baseTopic}/mode/state`\n });\n } else {\n node.send({\n payload: modeMapping[modestate],\n topic: `${baseTopic}/mode/state`\n });\n }\n\n } else {\n \n // Treat drive and mode seperatley...\n \n if (record.hasOwnProperty(\"Drive\")) {\n node.send({\n payload: record[\"Drive\"],\n topic: `${baseTopic}/power/state`\n });\n }\n \n if (record.hasOwnProperty(\"Mode\")) {\n node.send({\n payload: modeMapping[record[\"Mode\"]],\n topic: `${baseTopic}/mode/state`\n });\n }\n\n }\n \n // Manage temp setpoints based on mode...\n \n switch (cache.Mode) {\n \n case \"AUTO\":\n case \"AUTOHEAT\":\n \n node.send({\n payload: \"None\",\n topic: `${baseTopic}/temperature/state`\n });\n\n node.send({\n //payload: record[\"SetTemp1\"],\n payload: cache.SetTemp1,\n topic: `${baseTopic}/temperature_high/state`\n });\n \n node.send({\n //|payload: record[\"SetTemp2\"],\n payload: cache.SetTemp2,\n topic: `${baseTopic}/temperature_low/state`\n });\n \n break;\n \n case \"HEAT\":\n \n node.send({\n //|payload: record[\"SetTemp2\"],\n payload: cache.SetTemp2,\n topic: `${baseTopic}/temperature/state`\n });\n \n node.send({\n payload: null,\n topic: `${baseTopic}/temperature_high/state`\n });\n \n node.send({\n payload: null,\n topic: `${baseTopic}/temperature_low/state`\n });\n \n \n break;\n \n case \"COOL\":\n case \"DRY\":\n \n node.send({\n //payload: record[\"SetTemp1\"],\n payload: cache.SetTemp1,\n topic: `${baseTopic}/temperature/state`\n });\n \n node.send({\n payload: null,\n topic: `${baseTopic}/temperature_high/state`\n });\n \n node.send({\n payload: null,\n topic: `${baseTopic}/temperature_low/state`\n });\n \n break;\n\n default:\n \n \n node.send({\n payload: null,\n topic: `${baseTopic}/temperature/state`\n });\n \n node.send({\n payload: null,\n topic: `${baseTopic}/temperature_high/state`\n });\n \n node.send({\n payload: null,\n topic: `${baseTopic}/temperature_low/state`\n });\n \n break;\n \n }\n\n // Current temperature message\n if (record.hasOwnProperty(\"InletTemp\")) {\n var currentTemp = record[\"InletTemp\"];\n let currentTempMsg = {\n payload: currentTemp,\n topic: `${baseTopic}/current_temperature`\n };\n node.send(currentTempMsg);\n }\n\n // Fan speed message...\n if (record.hasOwnProperty(\"FanSpeed\")) {\n var fanSpeed = record[\"FanSpeed\"]; \n if (cache.Model == \"LC\") {\n \n // Percentage mapping for Lossnay...\n let fanSpeedMsg = {\n payload: Object.keys(fanModeMapping).indexOf(fanSpeed),\n topic: `${baseTopic}/fan_speed/state`\n };\n node.send(fanSpeedMsg);\n \n } else {\n \n // Level map for AC units...\n\n let mappedFanSpeed = fanModeMapping[fanSpeed];\n let fanSpeedMsg = {\n payload: mappedFanSpeed,\n topic: `${baseTopic}/fan_mode/state`\n };\n node.send(fanSpeedMsg);\n\n }\n }\n\n // Swing mode message\n if (record.hasOwnProperty(\"AirDirection\")) {\n var airDirection = record[\"AirDirection\"];\n let mappedSwingMode = swingModeMapping[airDirection];\n let swingModeMsg = {\n payload: mappedSwingMode,\n topic: `${baseTopic}/swing_mode/state`\n };\n node.send(swingModeMsg);\n }\n \n // Filter sign mode message\n if (record.hasOwnProperty(\"FilterSign\")) {\n let filterSignMsg = {\n payload: record[\"FilterSign\"],\n topic: `${baseTopic}/filter_sign/state`\n };\n node.send(filterSignMsg);\n }\n \n // Error sign mode message\n if (record.hasOwnProperty(\"ErrorSign\")) {\n let errorSignMsg = {\n payload: record[\"ErrorSign\"],\n topic: `${baseTopic}/error_sign/state`\n };\n node.send(errorSignMsg);\n }\n \n});\n\nreturn null;\n",
  247. "outputs": 1,
  248. "timeout": 0,
  249. "noerr": 0,
  250. "initialize": "",
  251. "finalize": "",
  252. "libs": [],
  253. "x": 600,
  254. "y": 460,
  255. "wires": [
  256. [
  257. "d4c484521d315266",
  258. "9fcf57953e3cab6f"
  259. ]
  260. ]
  261. },
  262. {
  263. "id": "bdbf0a8f25f63703",
  264. "type": "status",
  265. "z": "06d093a44e455a57",
  266. "g": "afd3d04528cf5eb1",
  267. "name": "Websocket Status",
  268. "scope": [
  269. "957fcdfcaa073380"
  270. ],
  271. "x": 850,
  272. "y": 140,
  273. "wires": [
  274. [
  275. "064bf80f5d0583a9"
  276. ]
  277. ]
  278. },
  279. {
  280. "id": "4d45f5bb512d6b93",
  281. "type": "mqtt in",
  282. "z": "06d093a44e455a57",
  283. "g": "afd3d04528cf5eb1",
  284. "name": "",
  285. "topic": "ae200/+/+/set",
  286. "qos": "2",
  287. "datatype": "auto-detect",
  288. "broker": "188340c12e25adf5",
  289. "nl": false,
  290. "rap": true,
  291. "rh": 0,
  292. "inputs": 0,
  293. "x": 130,
  294. "y": 500,
  295. "wires": [
  296. [
  297. "908f45f4f3fca18a",
  298. "c7653e4292c70726"
  299. ]
  300. ]
  301. },
  302. {
  303. "id": "064bf80f5d0583a9",
  304. "type": "function",
  305. "z": "06d093a44e455a57",
  306. "g": "afd3d04528cf5eb1",
  307. "name": "Availability",
  308. "func": "msg.payload = msg.status.fill === \"green\" ? \"online\" : \"offline\";\nmsg.topic = \"ae200/availability\";\nreturn msg;",
  309. "outputs": 1,
  310. "timeout": 0,
  311. "noerr": 0,
  312. "initialize": "",
  313. "finalize": "",
  314. "libs": [],
  315. "x": 1050,
  316. "y": 140,
  317. "wires": [
  318. [
  319. "25406b72b21d984c"
  320. ]
  321. ]
  322. },
  323. {
  324. "id": "25406b72b21d984c",
  325. "type": "mqtt out",
  326. "z": "06d093a44e455a57",
  327. "g": "afd3d04528cf5eb1",
  328. "name": "Retain",
  329. "topic": "",
  330. "qos": "",
  331. "retain": "true",
  332. "respTopic": "",
  333. "contentType": "",
  334. "userProps": "",
  335. "correl": "",
  336. "expiry": "",
  337. "broker": "188340c12e25adf5",
  338. "x": 1210,
  339. "y": 140,
  340. "wires": []
  341. },
  342. {
  343. "id": "a02b673b49a5ca66",
  344. "type": "websocket out",
  345. "z": "06d093a44e455a57",
  346. "g": "afd3d04528cf5eb1",
  347. "name": "AE-200 Web Socket",
  348. "server": "",
  349. "client": "9ee1a86948c818e6",
  350. "x": 840,
  351. "y": 340,
  352. "wires": []
  353. },
  354. {
  355. "id": "f9d1e2a70f2990bd",
  356. "type": "function",
  357. "z": "06d093a44e455a57",
  358. "g": "afd3d04528cf5eb1",
  359. "name": "Status Request",
  360. "func": "var mnetRecords = msg.payload.Packet.DatabaseManager[0].ControlGroup[0].MnetList[0].MnetRecord;\n\nvar xml = '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\\n';\nxml += '<Packet>\\n';\nxml += ' <Command>getRequest</Command>\\n';\nxml += ' <DatabaseManager>\\n';\n\nfor (var i = 0; i < mnetRecords.length; i++) {\n var record = mnetRecords[i];\n var group = record[\"$\"][\"Group\"];\n\n // Full known set of states...\n //xml += '<Mnet Group=\"' + group + '\" Drive=\"*\" Vent24h=\"*\" Mode=\"*\" VentMode=\"*\" ModeStatus=\"*\" SetTemp=\"*\" SetTemp1=\"*\" SetTemp2=\"*\" SetTemp3=\"*\" SetTemp4=\"*\" SetTemp5=\"*\" SetHumidity=\"*\" InletTemp=\"*\" InletHumidity=\"*\" AirDirection=\"*\" FanSpeed=\"*\" RemoCon=\"*\" DriveItem=\"*\" ModeItem=\"*\" SetTempItem=\"*\" FilterItem=\"*\" AirDirItem=\"*\" FanSpeedItem=\"*\" TimerItem=\"*\" CheckWaterItem=\"*\" FilterSign=\"*\" Hold=\"*\" EnergyControl=\"*\" EnergyControlIC=\"*\" SetbackControl=\"*\" Ventilation=\"*\" VentiDrive=\"*\" VentiFan=\"*\" Schedule=\"*\" ScheduleAvail=\"*\" ErrorSign=\"*\" CheckWater=\"*\" TempLimitCool=\"*\" TempLimitHeat=\"*\" TempLimit=\"*\" CoolMin=\"*\" CoolMax=\"*\" HeatMin=\"*\" HeatMax=\"*\" AutoMin=\"*\" AutoMax=\"*\" TurnOff=\"*\" MaxSaveValue=\"*\" RoomHumidity=\"*\" Brightness=\"*\" Occupancy=\"*\" NightPurge=\"*\" Humid=\"*\" Vent24hMode=\"*\" SnowFanMode=\"*\" InletTempHWHP=\"*\" OutletTempHWHP=\"*\" HeadTempHWHP=\"*\" OutdoorTemp=\"*\" BrineTemp=\"*\" HeadInletTempCH=\"*\" BACnetTurnOff=\"*\" AISmartStart=\"*\" Model=\"*\" SubModel=\"*\" GroupType=\"*\" IcKind=\"*\" AutoModeSW=\"*\" AutoModeSWEx=\"*\" DryModeSW=\"*\" FanModeSW=\"*\" SetbackModeSW=\"*\" FanSpeedSW=\"*\" FanAutoSW=\"*\" FanExLowSW=\"*\" AirDirectionSW=\"*\" AirStageSW=\"*\" AirAutoSW=\"*\" SwingSW=\"*\" VentilationSW=\"*\" BypassSW=\"*\" LcAutoSW=\"*\" HeatRecoverySW=\"*\" MidTempSW=\"*\" LowTempSW=\"*\" HeatingSW=\"*\" HeatingEcoSW=\"*\" HotWaterSW=\"*\" AntiFreezeSW=\"*\" CoolingSW=\"*\" TempRange1Low1=\"*\" TempRange1High1=\"*\" TempRange1Low2=\"*\" TempRange1High2=\"*\" TempRange1Low3=\"*\" TempRange1High3=\"*\" TempRange1Low4=\"*\" TempRange1High4=\"*\" TempRange1Low5=\"*\" TempRange1High5=\"*\" Deadband=\"*\" TempDetail=\"*\" TempDetailC=\"*\" TempDetail_C=\"*\" HumiditySW=\"*\" HoldSW=\"*\" ProhibitSW=\"*\" NightPurgeSW=\"*\" Vent24hSW=\"*\" HumidSW=\"*\" HumidAutoSW=\"*\" FanExHighSW=\"*\" HumidOffSW=\"*\" FanHumidSW=\"*\" CoolHumidSW=\"*\" AISmartStartSW=\"*\" RemoConProhibitSW=\"*\" />\\n';\n\n // Currently needed...\n xml += '<Mnet Group=\"' + group + '\" Drive=\"*\" Mode=\"*\" SetTemp1=\"*\" SetTemp2=\"*\" InletTemp=\"*\" AirDirection=\"*\" FanSpeed=\"*\" FilterSign=\"*\" Schedule=\"*\" ErrorSign=\"*\" Model=\"*\" />\\n' \n \n}\n\nxml += ' </DatabaseManager>\\n';\nxml += '</Packet>\\n';\n\nmsg = {payload: xml}\n\nreturn msg;",
  361. "outputs": 1,
  362. "timeout": 0,
  363. "noerr": 0,
  364. "initialize": "",
  365. "finalize": "",
  366. "libs": [],
  367. "x": 600,
  368. "y": 340,
  369. "wires": [
  370. [
  371. "a02b673b49a5ca66"
  372. ]
  373. ]
  374. },
  375. {
  376. "id": "88e4d9ef86236b0f",
  377. "type": "inject",
  378. "z": "06d093a44e455a57",
  379. "g": "afd3d04528cf5eb1",
  380. "name": "",
  381. "props": [
  382. {
  383. "p": "payload"
  384. },
  385. {
  386. "p": "topic",
  387. "vt": "str"
  388. }
  389. ],
  390. "repeat": "",
  391. "crontab": "",
  392. "once": false,
  393. "onceDelay": 0.1,
  394. "topic": "",
  395. "payload": "",
  396. "payloadType": "date",
  397. "x": 1140,
  398. "y": 400,
  399. "wires": [
  400. [
  401. "ab3d2158cf1feec2"
  402. ]
  403. ]
  404. },
  405. {
  406. "id": "ab3d2158cf1feec2",
  407. "type": "change",
  408. "z": "06d093a44e455a57",
  409. "g": "afd3d04528cf5eb1",
  410. "name": "Get Cache",
  411. "rules": [
  412. {
  413. "t": "set",
  414. "p": "payload",
  415. "pt": "msg",
  416. "to": "ae200_cache",
  417. "tot": "global"
  418. }
  419. ],
  420. "action": "",
  421. "property": "",
  422. "from": "",
  423. "to": "",
  424. "reg": false,
  425. "x": 1150,
  426. "y": 440,
  427. "wires": [
  428. [
  429. "5ab1e0b5fa9ce97d"
  430. ]
  431. ]
  432. },
  433. {
  434. "id": "5ab1e0b5fa9ce97d",
  435. "type": "debug",
  436. "z": "06d093a44e455a57",
  437. "g": "afd3d04528cf5eb1",
  438. "name": "debug 98",
  439. "active": true,
  440. "tosidebar": true,
  441. "console": false,
  442. "tostatus": false,
  443. "complete": "false",
  444. "statusVal": "",
  445. "statusType": "auto",
  446. "x": 1140,
  447. "y": 480,
  448. "wires": []
  449. },
  450. {
  451. "id": "92080183eec1ef07",
  452. "type": "function",
  453. "z": "06d093a44e455a57",
  454. "g": "afd3d04528cf5eb1",
  455. "name": "Raw States",
  456. "func": "\n// We need to update the raw states into the cache first\n// because some of the climate states are inter-dependant\n// other sates (e.g. temp high/low setpoint based on mode).\n\n// If there's no global cache yet, we can stop...\nif (typeof global.get(\"ae200_cache\") !== \"object\") {\n return null;\n}\n\n//const keysToInclude = [\"Drive\", \"Vent24h\", \"Mode\", \"VentMode\", \"ModeStatus\", \"SetTemp\", \"SetTemp1\", \"SetTemp2\", \"SetTemp3\", \"SetTemp4\", \"SetTemp5\", \"SetHumidity\", \"InletTemp\", \"InletHumidity\", \"AirDirection\", \"FanSpeed\", \"RemoCon\", \"DriveItem\", \"ModeItem\", \"SetTempItem\", \"FilterItem\", \"AirDirItem\", \"FanSpeedItem\", \"TimerItem\", \"CheckWaterItem\", \"FilterSign\", \"Hold\", \"EnergyControl\", \"EnergyControlIC\", \"SetbackControl\", \"Ventilation\", \"VentiDrive\", \"VentiFan\", \"Schedule\", \"ScheduleAvail\", \"ErrorSign\", \"CheckWater\", \"TempLimitCool\", \"TempLimitHeat\", \"TempLimit\", \"CoolMin\", \"CoolMax\", \"HeatMin\", \"HeatMax\", \"AutoMin\", \"AutoMax\", \"TurnOff\", \"MaxSaveValue\", \"RoomHumidity\", \"Brightness\", \"Occupancy\", \"NightPurge\", \"Humid\", \"Vent24hMode\", \"SnowFanMode\", \"InletTempHWHP\", \"OutletTempHWHP\", \"HeadTempHWHP\", \"OutdoorTemp\", \"BrineTemp\", \"HeadInletTempCH\", \"BACnetTurnOff\", \"AISmartStart\", \"Model\", \"SubModel\", \"GroupType\", \"IcKind\", \"AutoModeSW\", \"AutoModeSWEx\", \"DryModeSW\", \"FanModeSW\", \"SetbackModeSW\", \"FanSpeedSW\", \"FanAutoSW\", \"FanExLowSW\", \"AirDirectionSW\", \"AirStageSW\", \"AirAutoSW\", \"SwingSW\", \"VentilationSW\", \"BypassSW\", \"LcAutoSW\", \"HeatRecoverySW\", \"MidTempSW\", \"LowTempSW\", \"HeatingSW\", \"HeatingEcoSW\", \"HotWaterSW\", \"AntiFreezeSW\", \"CoolingSW\", \"TempRange1Low1\", \"TempRange1High1\", \"TempRange1Low2\", \"TempRange1High2\", \"TempRange1Low3\", \"TempRange1High3\", \"TempRange1Low4\", \"TempRange1High4\", \"TempRange1Low5\", \"TempRange1High5\", \"Deadband\", \"TempDetail\", \"TempDetailC\", \"TempDetail_C\", \"HumiditySW\", \"HoldSW\", \"ProhibitSW\", \"NightPurgeSW\", \"Vent24hSW\", \"HumidSW\", \"HumidAutoSW\", \"FanExHighSW\", \"HumidOffSW\", \"FanHumidSW\", \"CoolHumidSW\", \"AISmartStartSW\", \"RemoConProhibitSW\"];\nconst keysToInclude = [\"Drive\", \"Mode\", \"VentMode\", \"SetTemp1\", \"SetTemp2\", \"InletTemp\", \"AirDirection\", \"FanSpeed\", \"FilterSign\", \"Schedule\", \"ErrorSign\", \"Model\"];\n\nlet packet = msg.payload.Packet.DatabaseManager[0].Mnet;\nlet ae200_cache = global.get(\"ae200_cache\");\nconst baseTopic = \"ae200/mnet_\";\n\npacket.forEach(item => {\n let record = item.$\n let groupId = record.Group\n \n if (!ae200_cache[groupId]) {\n ae200_cache[groupId] = {};\n }\n\n for (let state in record) {\n if (state !== \"Group\" && keysToInclude.includes(state)) {\n \n // Set the cache state...\n ae200_cache[groupId][state] = record[state];\n \n // Send raw MQTT packet if we want it...\n node.send([{\n topic: `${baseTopic}${groupId}/${state}`,\n payload: record[state]\n }, null]);\n \n }\n }\n\n});\n\n// Save cache changes...\nglobal.set(\"ae200_cache\", ae200_cache);\n\n// Pass on the message...\nreturn [null, msg];\n",
  457. "outputs": 2,
  458. "timeout": 0,
  459. "noerr": 0,
  460. "initialize": "",
  461. "finalize": "",
  462. "libs": [],
  463. "x": 590,
  464. "y": 400,
  465. "wires": [
  466. [
  467. "546bd26ea31e65ca"
  468. ],
  469. [
  470. "f2fb06c469c4ae05",
  471. "d4c484521d315266"
  472. ]
  473. ]
  474. },
  475. {
  476. "id": "908f45f4f3fca18a",
  477. "type": "function",
  478. "z": "06d093a44e455a57",
  479. "g": "afd3d04528cf5eb1",
  480. "name": "Set Climate",
  481. "func": "const fanModeMapping = { \"Auto\": \"AUTO\", \"Low\": \"LOW\", \"Medium L\": \"MID2\", \"Medium H\": \"MID1\", \"High\": \"HIGH\"};\nconst swingModeMapping = { \"Horizontal\": \"HORIZONTAL\", \"Mid 0\": \"MID0\", \"Mid 1\": \"MID1\", \"Mid 2\": \"MID2\", \"Vertical\": \"VERTICAL\", \"Swing\": \"SWING\", \"Auto\": \"AUTO\" };\nconst modeMapping = { \"off\": \"OFF\", \"cool\": \"COOL\", \"dry\": \"DRY\", \"fan_only\": \"FAN\", \"heat\": \"HEAT\", \"auto\": \"AUTO\", \"lc_auto\": \"LC_AUTO\", \"Heat Recovery\": \"HEATRECOVERY\", \"Bypass\": \"BYPASS\"};\n\nvar groupId = msg.topic.match(/mnet_(\\d+)/)[1];\nvar topicParts = msg.topic.split('/');\nvar state_type = topicParts[topicParts.length - 2];\n\nlet ae200_cache = global.get(\"ae200_cache\");\nlet cache = ae200_cache[groupId];\n\nvar keyName;\nvar value = msg.payload;\nvar setDrive = null;\n\nswitch (state_type) {\n case \"power\":\n keyName = \"Drive\";\n break;\n \n case \"mode\":\n if (value === \"off\") {\n keyName = \"Drive\";\n value = \"OFF\";\n } else if (value === \"on\") {\n keyName = \"Mode\";\n value = modeMapping[value];\n setDrive = \"ON\";\n } else {\n keyName = \"Mode\";\n if (cache.Model == \"LC\" && value == \"Auto\") {value = \"lc_auto\";}\n if (cache.Model == \"IC\") {setDrive = \"ON\";}\n value = modeMapping[value];\n }\n break;\n \n case \"swing_mode\":\n keyName = \"AirDirection\";\n value = swingModeMapping[value];\n break;\n \n case \"fan_mode\":\n keyName = \"FanSpeed\";\n value = fanModeMapping[value];\n break;\n \n case \"fan_speed\":\n if (value == 0) {\n // Power off?\n keyName = \"Drive\";\n value = \"OFF\";\n } else {\n keyName = \"FanSpeed\";\n value = Object.values(fanModeMapping)[value];\n setDrive = \"ON\";\n }\n break;\n \n case \"temperature\":\n \n switch (cache.Mode)\n {\n \n case \"HEAT\":\n keyName = \"SetTemp2\";\n break;\n \n case \"COOL\":\n case \"DRY\":\n keyName = \"SetTemp1\";\n break;\n \n default:\n node.error(\"Unable to update setpoint.\");\n break;\n \n } \n\n break;\n \n case \"temperature_low\":\n keyName = \"SetTemp2\";\n break;\n \n case \"temperature_high\":\n keyName = \"SetTemp1\";\n break;\n \n default:\n node.error(\"Set type not handled.\");\n break;\n \n}\n\nif (!keyName) {\n return null;\n}\n\n// Construct the XML string\nvar xmlString = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n' +\n '<Packet>\\n' +\n ' <Command>setResponse</Command>\\n' +\n ' <DatabaseManager>\\n' +\n ' <Mnet Group=\"' + groupId + '\" ' + keyName + '=\"' + value + '\"';\nif (setDrive !== null) {\n xmlString += ' Drive=\"' + setDrive + '\"';\n}\nxmlString += ' />\\n' +\n ' </DatabaseManager>\\n' +\n '</Packet>';\n\n// Set the constructed XML string as the new payload\nmsg.payload = xmlString;\n\n// Return the message object\nreturn msg;\n",
  482. "outputs": 1,
  483. "timeout": 0,
  484. "noerr": 0,
  485. "initialize": "",
  486. "finalize": "",
  487. "libs": [],
  488. "x": 310,
  489. "y": 500,
  490. "wires": [
  491. [
  492. "9f0b76bb906c9fb1",
  493. "c7653e4292c70726"
  494. ]
  495. ]
  496. },
  497. {
  498. "id": "9f0b76bb906c9fb1",
  499. "type": "websocket out",
  500. "z": "06d093a44e455a57",
  501. "g": "afd3d04528cf5eb1",
  502. "name": "AE-200 Web Socket",
  503. "server": "",
  504. "client": "9ee1a86948c818e6",
  505. "x": 340,
  506. "y": 540,
  507. "wires": []
  508. },
  509. {
  510. "id": "ff9ea310bc5f7dfe",
  511. "type": "template",
  512. "z": "06d093a44e455a57",
  513. "g": "afd3d04528cf5eb1",
  514. "name": "MnetStatus",
  515. "field": "payload",
  516. "fieldType": "msg",
  517. "format": "handlebars",
  518. "syntax": "plain",
  519. "template": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<Packet>\n<Command>getRequest</Command>\n<DatabaseManager>\n<SystemData MnetStatus=\"*\" />\n</DatabaseManager>\n</Packet>",
  520. "output": "str",
  521. "x": 350,
  522. "y": 140,
  523. "wires": [
  524. [
  525. "e7cc387079689a12"
  526. ]
  527. ]
  528. },
  529. {
  530. "id": "359efa85d3785f3c",
  531. "type": "debug",
  532. "z": "06d093a44e455a57",
  533. "g": "afd3d04528cf5eb1",
  534. "name": "debug 101",
  535. "active": false,
  536. "tosidebar": true,
  537. "console": false,
  538. "tostatus": false,
  539. "complete": "false",
  540. "statusVal": "",
  541. "statusType": "auto",
  542. "x": 350,
  543. "y": 420,
  544. "wires": []
  545. },
  546. {
  547. "id": "292a2d3678e64bc3",
  548. "type": "inject",
  549. "z": "06d093a44e455a57",
  550. "g": "afd3d04528cf5eb1",
  551. "name": "Keep Alive",
  552. "props": [
  553. {
  554. "p": "payload"
  555. },
  556. {
  557. "p": "topic",
  558. "vt": "str"
  559. }
  560. ],
  561. "repeat": "60",
  562. "crontab": "",
  563. "once": false,
  564. "onceDelay": 0.1,
  565. "topic": "",
  566. "payload": "",
  567. "payloadType": "date",
  568. "x": 150,
  569. "y": 140,
  570. "wires": [
  571. [
  572. "ff9ea310bc5f7dfe"
  573. ]
  574. ]
  575. },
  576. {
  577. "id": "18a0944d01943312",
  578. "type": "function",
  579. "z": "06d093a44e455a57",
  580. "g": "afd3d04528cf5eb1",
  581. "name": "Status Check",
  582. "func": "\nif (msg.payload.Packet.DatabaseManager[0].SystemData[0].$.MnetStatus == \"NORMAL\") {\n msg.payload = \"online\";\n msg.topic = \"ae200/availability\";\n return msg; \n} else {\n return null;\n}",
  583. "outputs": 1,
  584. "timeout": 0,
  585. "noerr": 0,
  586. "initialize": "",
  587. "finalize": "",
  588. "libs": [],
  589. "x": 590,
  590. "y": 520,
  591. "wires": [
  592. [
  593. "9fcf57953e3cab6f"
  594. ]
  595. ]
  596. },
  597. {
  598. "id": "5f2595c6be7136c2",
  599. "type": "template",
  600. "z": "06d093a44e455a57",
  601. "g": "afd3d04528cf5eb1",
  602. "name": "AlarmStatusList",
  603. "field": "payload",
  604. "fieldType": "msg",
  605. "format": "handlebars",
  606. "syntax": "plain",
  607. "template": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<Packet>\n<Command>getRequest</Command>\n<DatabaseManager>\n<Mnet>\n<AlarmStatusList />\n</Mnet>\n</DatabaseManager>\n</Packet>",
  608. "output": "str",
  609. "x": 360,
  610. "y": 180,
  611. "wires": [
  612. [
  613. "e7cc387079689a12"
  614. ]
  615. ]
  616. },
  617. {
  618. "id": "d3c54ccf89aef8c8",
  619. "type": "inject",
  620. "z": "06d093a44e455a57",
  621. "g": "afd3d04528cf5eb1",
  622. "name": "",
  623. "props": [
  624. {
  625. "p": "payload"
  626. },
  627. {
  628. "p": "topic",
  629. "vt": "str"
  630. }
  631. ],
  632. "repeat": "",
  633. "crontab": "",
  634. "once": false,
  635. "onceDelay": 0.1,
  636. "topic": "",
  637. "payload": "",
  638. "payloadType": "date",
  639. "x": 140,
  640. "y": 180,
  641. "wires": [
  642. [
  643. "5f2595c6be7136c2"
  644. ]
  645. ]
  646. },
  647. {
  648. "id": "aa56d185614cca6f",
  649. "type": "join",
  650. "z": "06d093a44e455a57",
  651. "g": "afd3d04528cf5eb1",
  652. "name": "",
  653. "mode": "custom",
  654. "build": "object",
  655. "property": "payload",
  656. "propertyType": "msg",
  657. "key": "topic",
  658. "joiner": "\\n",
  659. "joinerType": "str",
  660. "useparts": false,
  661. "accumulate": false,
  662. "timeout": "",
  663. "count": "2",
  664. "reduceRight": false,
  665. "reduceExp": "",
  666. "reduceInit": "",
  667. "reduceInitType": "num",
  668. "reduceFixup": "",
  669. "x": 990,
  670. "y": 240,
  671. "wires": [
  672. [
  673. "226482e540b69d27"
  674. ]
  675. ]
  676. },
  677. {
  678. "id": "b1529e96e463ee0e",
  679. "type": "change",
  680. "z": "06d093a44e455a57",
  681. "g": "afd3d04528cf5eb1",
  682. "name": "",
  683. "rules": [
  684. {
  685. "t": "set",
  686. "p": "payload",
  687. "pt": "msg",
  688. "to": "payload.Packet.DatabaseManager[0].ControlGroup[0].MnetList[0].MnetRecord",
  689. "tot": "msg"
  690. },
  691. {
  692. "t": "set",
  693. "p": "topic",
  694. "pt": "msg",
  695. "to": "devices",
  696. "tot": "str"
  697. }
  698. ],
  699. "action": "",
  700. "property": "",
  701. "from": "",
  702. "to": "",
  703. "reg": false,
  704. "x": 800,
  705. "y": 240,
  706. "wires": [
  707. [
  708. "aa56d185614cca6f"
  709. ]
  710. ]
  711. },
  712. {
  713. "id": "e2ee675075332f3e",
  714. "type": "change",
  715. "z": "06d093a44e455a57",
  716. "g": "afd3d04528cf5eb1",
  717. "name": "",
  718. "rules": [
  719. {
  720. "t": "set",
  721. "p": "payload",
  722. "pt": "msg",
  723. "to": "payload.Packet.DatabaseManager[0].Mnet",
  724. "tot": "msg"
  725. },
  726. {
  727. "t": "set",
  728. "p": "topic",
  729. "pt": "msg",
  730. "to": "states",
  731. "tot": "str"
  732. }
  733. ],
  734. "action": "",
  735. "property": "",
  736. "from": "",
  737. "to": "",
  738. "reg": false,
  739. "x": 800,
  740. "y": 280,
  741. "wires": [
  742. [
  743. "aa56d185614cca6f"
  744. ]
  745. ]
  746. },
  747. {
  748. "id": "74109a521cf1af56",
  749. "type": "debug",
  750. "z": "06d093a44e455a57",
  751. "g": "afd3d04528cf5eb1",
  752. "name": "debug 1",
  753. "active": false,
  754. "tosidebar": true,
  755. "console": false,
  756. "tostatus": false,
  757. "complete": "false",
  758. "statusVal": "",
  759. "statusType": "auto",
  760. "x": 1320,
  761. "y": 240,
  762. "wires": []
  763. },
  764. {
  765. "id": "226482e540b69d27",
  766. "type": "function",
  767. "z": "06d093a44e455a57",
  768. "g": "afd3d04528cf5eb1",
  769. "name": "Combine",
  770. "func": "// Input data (from msg.payload)\nlet devices = msg.payload.devices;\nlet states = msg.payload.states;\n\n// Create an empty object to store the grouped data\nlet groupedData = {};\n\n// Iterate over devices to build the group structure\ndevices.forEach(device => {\n let groupId = device.$.Group;\n if (!groupedData[groupId]) {\n // Initialize the group with the Group and GroupNameWeb\n groupedData[groupId] = {\n Group: groupId,\n GroupNameWeb: device.$.GroupNameWeb\n };\n }\n});\n\n// Iterate over states and add unique state keys to the relevant group\nstates.forEach(state => {\n let groupId = state.$.Group;\n if (groupedData[groupId]) {\n Object.keys(state.$).forEach(key => {\n // Ignore already existing keys (i.e., duplicate keys)\n if (!groupedData[groupId][key]) {\n groupedData[groupId][key] = state.$[key];\n }\n });\n }\n});\n\n// Return the grouped data as an object with groupId as the key\nmsg.payload = groupedData;\nreturn msg;\n",
  771. "outputs": 1,
  772. "timeout": 0,
  773. "noerr": 0,
  774. "initialize": "",
  775. "finalize": "",
  776. "libs": [],
  777. "x": 1140,
  778. "y": 240,
  779. "wires": [
  780. [
  781. "33d58eeb2d9b2ba9"
  782. ]
  783. ]
  784. },
  785. {
  786. "id": "33d58eeb2d9b2ba9",
  787. "type": "change",
  788. "z": "06d093a44e455a57",
  789. "g": "afd3d04528cf5eb1",
  790. "name": "",
  791. "rules": [
  792. {
  793. "t": "set",
  794. "p": "ae200_cache",
  795. "pt": "global",
  796. "to": "payload",
  797. "tot": "msg"
  798. }
  799. ],
  800. "action": "",
  801. "property": "",
  802. "from": "",
  803. "to": "",
  804. "reg": false,
  805. "x": 1190,
  806. "y": 280,
  807. "wires": [
  808. [
  809. "74109a521cf1af56",
  810. "44616ffc4f3dbc73"
  811. ]
  812. ]
  813. },
  814. {
  815. "id": "f190122e9c98fe5c",
  816. "type": "switch",
  817. "z": "06d093a44e455a57",
  818. "g": "afd3d04528cf5eb1",
  819. "name": "",
  820. "property": "payload.Packet.DatabaseManager[0].Mnet[0].$.Model",
  821. "propertyType": "msg",
  822. "rules": [
  823. {
  824. "t": "nempty"
  825. }
  826. ],
  827. "checkall": "true",
  828. "repair": false,
  829. "outputs": 1,
  830. "x": 570,
  831. "y": 280,
  832. "wires": [
  833. [
  834. "e2ee675075332f3e"
  835. ]
  836. ]
  837. },
  838. {
  839. "id": "615866257bf8c479",
  840. "type": "switch",
  841. "z": "06d093a44e455a57",
  842. "g": "afd3d04528cf5eb1",
  843. "name": "",
  844. "property": "payload.Packet.DatabaseManager[0].ControlGroup[0].MnetList[0].MnetRecord[0].$.GroupNameWeb",
  845. "propertyType": "msg",
  846. "rules": [
  847. {
  848. "t": "nempty"
  849. }
  850. ],
  851. "checkall": "true",
  852. "repair": false,
  853. "outputs": 1,
  854. "x": 570,
  855. "y": 240,
  856. "wires": [
  857. [
  858. "b1529e96e463ee0e"
  859. ]
  860. ]
  861. },
  862. {
  863. "id": "44616ffc4f3dbc73",
  864. "type": "function",
  865. "z": "06d093a44e455a57",
  866. "g": "afd3d04528cf5eb1",
  867. "name": "Discovery Packets",
  868. "func": "\n// Define the device information once\nvar ha_device = {\n identifiers: [\"AE200_Controller\"],\n manufacturer: \"Mitsubishi\",\n name: \"AE-200\",\n model: \"AE-200\"\n};\n\nlet ae200_cache = global.get(\"ae200_cache\");\n\nObject.entries(ae200_cache).forEach(([group, device]) => {\n\n var name = device.GroupNameWeb;\n var uniqueId = \"mnet_\" + group;\n var baseTopic = `ae200/${uniqueId}`;\n\n // Create base discovery message with common properties\n let configMsg = {\n payload: {\n name: name,\n object_id: uniqueId,\n device: ha_device,\n availability_topic: \"ae200/availability\",\n payload_available: \"online\",\n payload_not_available: \"offline\",\n unique_id: uniqueId,\n platform: \"mqtt\" // Adjusted inside conditionals if needed\n },\n topic: \"\" // Adjusted later based on model\n };\n \n if (device.Model === \"IC\") {\n \n // AC Unit (climate entity)\n Object.assign(configMsg.payload, {\n modes: [\"off\", \"cool\", \"dry\", \"fan_only\", \"heat\", \"auto\"],\n mode_command_topic: `${baseTopic}/mode/set`,\n mode_state_topic: `${baseTopic}/mode/state`,\n \n temperature_state_topic: `${baseTopic}/temperature/state`,\n temperature_command_topic: `${baseTopic}/temperature/set`,\n temperature_high_state_topic: `${baseTopic}/temperature_high/state`,\n temperature_high_command_topic: `${baseTopic}/temperature_high/set`,\n temperature_low_state_topic: `${baseTopic}/temperature_low/state`,\n temperature_low_command_topic: `${baseTopic}/temperature_low/set`,\n current_temperature_topic: `${baseTopic}/current_temperature`,\n \n fan_mode_state_topic: `${baseTopic}/fan_mode/state`,\n fan_mode_command_topic: `${baseTopic}/fan_mode/set`,\n fan_modes: [\"Auto\", \"Low\", \"Medium L\", \"Medium H\", \"High\"],\n \n swing_mode_state_topic: `${baseTopic}/swing_mode/state`,\n swing_mode_command_topic: `${baseTopic}/swing_mode/set`,\n swing_modes: [\"Horizontal\", \"Mid 0\", \"Mid 1\", \"Mid 2\", \"Vertical\", \"Swing\", \"Auto\"],\n \n min_temp: 14,\n max_temp: 26,\n temp_step: 0.5,\n temperature_unit: \"C\",\n //platform: \"mqtt\"\n });\n \n configMsg.topic = `homeassistant/climate/${uniqueId}/config`;\n \n } else if (device.Model === \"LC\") {\n \n // Lossnay Unit (fan entity)\n Object.assign(configMsg.payload, {\n state_topic: `${baseTopic}/power/state`,\n command_topic: `${baseTopic}/power/set`,\n\n percentage_state_topic : `${baseTopic}/fan_speed/state`,\n percentage_command_topic : `${baseTopic}/fan_speed/set`,\n speed_range_min: 1,\n speed_range_max: 4,\n //fan_modes: [\"LOW\", \"MID2\", \"MID1\", \"HIGH\"],\n \n preset_mode_state_topic: `${baseTopic}/mode/state`,\n preset_mode_command_topic: `${baseTopic}/mode/set`,\n preset_modes : [\"Auto\", \"Heat Recovery\", \"Bypass\"],\n //platform: \"fan\"\n });\n \n configMsg.topic = `homeassistant/fan/${uniqueId}/config`;\n \n }\n \n // Output the configuration message\n configMsg.payload = JSON.stringify(configMsg.payload);\n node.send([configMsg, null]);\n \n // Now let's add a filter sign for this...\n if (device.Model === \"IC\") {\n \n let filterMsg = {\n payload: {\n name: name + \" Filter\",\n object_id: uniqueId + \"_filter\",\n device: ha_device,\n availability_topic: \"ae200/availability\",\n payload_available: \"online\",\n payload_not_available: \"offline\",\n unique_id: uniqueId + \"_filter\",\n state_topic: `${baseTopic}/filter_sign/state`,\n payload_on: \"ON\",\n payload_off: \"OFF\",\n device_class: \"problem\",\n icon: \"mdi:air-filter\",\n },\n topic: `homeassistant/binary_sensor/${uniqueId}/filter_sign/config`\n };\n \n // Output the configuration message\n filterMsg.payload = JSON.stringify(filterMsg.payload);\n node.send([filterMsg, null]);\n \n }\n \n // And finally, and error sign...\n let errorMsg = {\n payload: {\n name: name + \" Error\",\n object_id: uniqueId + \"_error\",\n device: ha_device,\n availability_topic: \"ae200/availability\",\n payload_available: \"online\",\n payload_not_available: \"offline\",\n unique_id: uniqueId + \"_error\",\n state_topic: `${baseTopic}/error_sign/state`,\n payload_on: \"ON\",\n payload_off: \"OFF\",\n device_class: \"problem\", // Marks as a problem in HA\n icon: \"mdi:alert-circle-outline\",\n },\n topic: `homeassistant/binary_sensor/${uniqueId}/error_sign/config`\n };\n\n\n // Output the configuration message\n errorMsg.payload = JSON.stringify(errorMsg.payload);\n node.send([errorMsg, null]);\n \n \n});\n\nreturn null;\n",
  869. "outputs": 1,
  870. "timeout": 0,
  871. "noerr": 0,
  872. "initialize": "",
  873. "finalize": "",
  874. "libs": [],
  875. "x": 1170,
  876. "y": 320,
  877. "wires": [
  878. [
  879. "290dc8f2945a6a99",
  880. "74109a521cf1af56"
  881. ]
  882. ]
  883. },
  884. {
  885. "id": "290dc8f2945a6a99",
  886. "type": "mqtt out",
  887. "z": "06d093a44e455a57",
  888. "g": "afd3d04528cf5eb1",
  889. "name": "Retain",
  890. "topic": "",
  891. "qos": "",
  892. "retain": "true",
  893. "respTopic": "",
  894. "contentType": "",
  895. "userProps": "",
  896. "correl": "",
  897. "expiry": "",
  898. "broker": "188340c12e25adf5",
  899. "x": 1350,
  900. "y": 320,
  901. "wires": []
  902. },
  903. {
  904. "id": "546bd26ea31e65ca",
  905. "type": "debug",
  906. "z": "06d093a44e455a57",
  907. "g": "afd3d04528cf5eb1",
  908. "name": "debug 99",
  909. "active": false,
  910. "tosidebar": true,
  911. "console": false,
  912. "tostatus": false,
  913. "complete": "false",
  914. "statusVal": "",
  915. "statusType": "auto",
  916. "x": 800,
  917. "y": 400,
  918. "wires": []
  919. },
  920. {
  921. "id": "c7653e4292c70726",
  922. "type": "debug",
  923. "z": "06d093a44e455a57",
  924. "g": "afd3d04528cf5eb1",
  925. "name": "debug 3",
  926. "active": false,
  927. "tosidebar": true,
  928. "console": false,
  929. "tostatus": false,
  930. "complete": "false",
  931. "statusVal": "",
  932. "statusType": "auto",
  933. "x": 300,
  934. "y": 460,
  935. "wires": []
  936. },
  937. {
  938. "id": "4bd563752b45384c",
  939. "type": "function",
  940. "z": "06d093a44e455a57",
  941. "g": "afd3d04528cf5eb1",
  942. "name": "Cache Empty?",
  943. "func": "if (typeof global.get(\"ae200_cache\") !== \"object\") {\n return msg;\n} else {\n return null;\n}",
  944. "outputs": 1,
  945. "timeout": 0,
  946. "noerr": 0,
  947. "initialize": "",
  948. "finalize": "",
  949. "libs": [],
  950. "x": 360,
  951. "y": 60,
  952. "wires": [
  953. [
  954. "bbc90588f0c1632e"
  955. ]
  956. ]
  957. },
  958. {
  959. "id": "b704ebbbe4c5e9db",
  960. "type": "inject",
  961. "z": "06d093a44e455a57",
  962. "g": "afd3d04528cf5eb1",
  963. "name": "Startup",
  964. "props": [
  965. {
  966. "p": "payload"
  967. },
  968. {
  969. "p": "topic",
  970. "vt": "str"
  971. }
  972. ],
  973. "repeat": "",
  974. "crontab": "",
  975. "once": true,
  976. "onceDelay": "2",
  977. "topic": "",
  978. "payload": "",
  979. "payloadType": "date",
  980. "x": 140,
  981. "y": 60,
  982. "wires": [
  983. [
  984. "4bd563752b45384c"
  985. ]
  986. ]
  987. },
  988. {
  989. "id": "9ee1a86948c818e6",
  990. "type": "websocket-client",
  991. "path": "ws://10.10.0.15/b_xmlproc/",
  992. "tls": "",
  993. "wholemsg": "false",
  994. "hb": "30",
  995. "subprotocol": "b_xmlproc",
  996. "headers": [
  997. {
  998. "keyType": "other",
  999. "keyValue": "Origin",
  1000. "valueType": "other",
  1001. "valueValue": "null"
  1002. }
  1003. ]
  1004. },
  1005. {
  1006. "id": "188340c12e25adf5",
  1007. "type": "mqtt-broker",
  1008. "name": "TC MQTT",
  1009. "broker": "10.10.0.45",
  1010. "port": "1883",
  1011. "clientid": "",
  1012. "autoConnect": true,
  1013. "usetls": false,
  1014. "protocolVersion": "4",
  1015. "keepalive": "60",
  1016. "cleansession": true,
  1017. "autoUnsubscribe": true,
  1018. "birthTopic": "",
  1019. "birthQos": "0",
  1020. "birthPayload": "",
  1021. "birthMsg": {},
  1022. "closeTopic": "",
  1023. "closeQos": "0",
  1024. "closePayload": "",
  1025. "closeMsg": {},
  1026. "willTopic": "",
  1027. "willQos": "0",
  1028. "willPayload": "",
  1029. "willMsg": {},
  1030. "userProps": "",
  1031. "sessionExpiry": ""
  1032. }
  1033. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement