[{"id":"5ae3ca12152d6384","type":"tab","label":"流程 2","disabled":false,"info":"","env":[]},{"id":"604dd75493635a55","type":"modbus-flex-write","z":"5ae3ca12152d6384","name":"日立网关","showStatusActivities":false,"showErrors":false,"showWarnings":true,"server":"7e689472fa890182","emptyMsgOnFail":false,"keepMsgProperties":false,"delayOnStart":false,"startDelayTime":"","x":760,"y":740,"wires":[[],[]]},{"id":"d2d656c4313ead04","type":"mqtt in","z":"5ae3ca12152d6384","name":"运行模式","topic":"homeassistant/climate/zhonghong/+/mode/set","qos":"0","datatype":"auto-detect","broker":"cc150b3a.bacbc8","nl":false,"rap":true,"rh":0,"inputs":0,"x":300,"y":700,"wires":[["8fc95f92c1e953bb"]]},{"id":"8fc95f92c1e953bb","type":"function","z":"5ae3ca12152d6384","name":"function 5","func":"// 获取主题\nconst topic = msg.topic;\nconst msg_0=msg.payload ;\nlet msg_1;\nlet registerAddress;\n// 使用正则表达式匹配出 "1-1"\nconst match = /\\/(\\d+-\\d+)\\/mode\\/set$/.exec(topic);\n// 如果匹配成功,则将匹配结果存储在 payload 中\nif (match) {\n const acNumber = match[1];\n if (acNumber === "1-1") {\n registerAddress = 4134;\n } else if (acNumber === "1-2") {\n registerAddress = 4138;\n } else if (acNumber === "2-1") {\n registerAddress = 4142;\n } else if (acNumber === "2-2") {\n registerAddress = 4146;\n }\n}\nif (msg_0 == "cool") \n { msg_1 = 1};\nif (msg_0 == "dry") \n {msg_1 = 2};\nif (msg_0 == "fan_only") \n {msg_1 = 4};\nif (msg_0 == "off") \n { msg.payload = null };\nmsg.payload = { 'value': msg_1, 'fc': 6, 'unitid': 1, 'address': registerAddress, 'quantity': 1 };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":700,"wires":[["604dd75493635a55"]]},{"id":"96db700c2db5a657","type":"mqtt in","z":"5ae3ca12152d6384","name":"开关机","topic":"homeassistant/climate/zhonghong/+/power/set","qos":"0","datatype":"auto-detect","broker":"cc150b3a.bacbc8","nl":false,"rap":true,"rh":0,"inputs":0,"x":290,"y":620,"wires":[["a914cf9733c34b9e"]]},{"id":"503bed9be84443dc","type":"mqtt in","z":"5ae3ca12152d6384","name":"风速","topic":"homeassistant/climate/zhonghong/+/fan/set","qos":"0","datatype":"auto-detect","broker":"cc150b3a.bacbc8","nl":false,"rap":true,"rh":0,"inputs":0,"x":290,"y":780,"wires":[["4e636cb9963f95f2"]]},{"id":"a914cf9733c34b9e","type":"function","z":"5ae3ca12152d6384","name":"function 6","func":"// 获取主题\nconst topic = msg.topic;\nconst msg_0=msg.payload ;\nlet msg_1;\nlet registerAddress;\n// 使用正则表达式匹配出 "1-1"\nconst match = /\\/(\\d+-\\d+)\\/power\\/set$/.exec(topic);\n// 如果匹配成功,则将匹配结果存储在 payload 中\nif (match) {\n const acNumber = match[1];\n if (acNumber === "1-1") {\n registerAddress = 4132;\n } else if (acNumber === "1-2") {\n registerAddress = 4136;\n } else if (acNumber === "2-1") {\n registerAddress = 4140;\n } else if (acNumber === "2-2") {\n registerAddress = 4144;\n }\n}\nif (msg_0=="ON")\n { msg_1= 1};\nif (msg_0 == "OFF")\n { msg_1 = 0};\nmsg.payload = { 'value': msg_1, 'fc': 6, 'unitid': 1, 'address': registerAddress, 'quantity': 1 };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":620,"wires":[["604dd75493635a55"]]},{"id":"4e636cb9963f95f2","type":"function","z":"5ae3ca12152d6384","name":"function 7","func":"// 获取主题\nconst topic = msg.topic;\nconst msg_0 = msg.payload;\nlet msg_1;\nlet registerAddress;\n// 使用正则表达式匹配出 "1-1"\nconst match = /\\/(\\d+-\\d+)\\/fan\\/set$/.exec(topic);\n// 如果匹配成功,则将匹配结果存储在 payload 中\nif (match) {\n const acNumber = match[1];\n if (acNumber === "1-1") {\n registerAddress = 4135;\n } else if (acNumber === "1-2") {\n registerAddress = 4139;\n } else if (acNumber === "2-1") {\n registerAddress = 4143;\n } else if (acNumber === "2-2") {\n registerAddress = 4147;\n }\n}\nif (msg_0 == "high") \n { msg_1 = 1 };\nif (msg_0 == "medium") \n { msg_1 = 2 };\nif (msg_0 == "low") \n { msg_1 = 4 };\nmsg.payload = { 'value': msg_1, 'fc': 6, 'unitid': 1, 'address': registerAddress, 'quantity': 1 };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":780,"wires":[["604dd75493635a55"]]},{"id":"f64c24af608752e5","type":"mqtt in","z":"5ae3ca12152d6384","name":"温度设定","topic":"homeassistant/climate/zhonghong/+/temp/set","qos":"0","datatype":"auto-detect","broker":"cc150b3a.bacbc8","nl":false,"rap":true,"rh":0,"inputs":0,"x":300,"y":860,"wires":[["b70b97c6ba7049ee"]]},{"id":"b70b97c6ba7049ee","type":"function","z":"5ae3ca12152d6384","name":"function 8","func":"// 获取主题\nconst topic = msg.topic;\nconst msg_0=msg.payload ;\nlet msg_1 ;\nlet registerAddress;\n// 使用正则表达式匹配出 "1-1"\nconst match = /\\/(\\d+-\\d+)\\/temp\\/set$/.exec(topic);\n// 如果匹配成功,则将匹配结果存储在 payload 中\nif (match) {\n const acNumber = match[1];\n if (acNumber === "1-1") {\n registerAddress = 4133;\n } else if (acNumber === "1-2") {\n registerAddress = 4137;\n } else if (acNumber === "2-1") {\n registerAddress = 4141;\n } else if (acNumber === "2-2") {\n registerAddress = 4145;\n }\n}\nif (msg_0< 19)\n {\n msg_1=19;\n msg.payload = { 'value': msg_1, 'fc': 6, 'unitid': 1, 'address': registerAddress, 'quantity': 1 };\n }\nelse if(msg_0 >30)\n { \n msg_1 = 30; \n msg.payload = { 'value': msg_1, 'fc': 6, 'unitid': 1, 'address': registerAddress, 'quantity': 1 };\n }\nelse \n{\n msg.payload = { 'value': msg_0, 'fc': 6, 'unitid': 1, 'address': registerAddress, 'quantity': 1 };\n };\nreturn msg ;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":860,"wires":[["604dd75493635a55"]]},{"id":"5605b6bfcfa63a32","type":"modbus-read","z":"5ae3ca12152d6384","name":"读取日立网关数据","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"showWarnings":true,"unitid":"1","dataType":"HoldingRegister","adr":"198","quantity":"6","rate":"1","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"7e689472fa890182","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":270,"y":280,"wires":[["b246650bb0e8d632","ff4925a7789d6a61","d651c18160b66ffd"],[]]},{"id":"b246650bb0e8d632","type":"function","z":"5ae3ca12152d6384","name":"temperature","func":"const msg_0 = msg.payload;\nmsg.payload = msg_0[1];\nmsg.topic ="homeassistant/climate/zhonghong/1-1/temp/state"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":380,"wires":[["50b4f45eb615ae6f"]]},{"id":"ff4925a7789d6a61","type":"function","z":"5ae3ca12152d6384","name":"mode","func":"\nconst msg_0 = msg.payload;\nvar msg_1 = ""\nswitch (msg_0[2]) {\n case 1:\n msg_1 = 'cool';\n break;\n case 2:\n msg_1 = 'dry';\n break;\n case 4:\n msg_1 = 'fan_only';\n break;\n case 8:\n msg_1 = 'heat';\n break;\n default:\n msg_1 = 'off';\n}\nif (msg_0[0]==0) {\n msg_1 = 'off';}\nmsg.topic ="homeassistant/climate/zhonghong/1-1/mode/state";\nmsg.payload = msg_1;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":440,"wires":[["273ce04bd36d52cb"]]},{"id":"d651c18160b66ffd","type":"function","z":"5ae3ca12152d6384","name":"FAN","func":"const msg_0 = msg.payload;\nvar msg_1 =""\nswitch (msg_0[3]) {\n case 1:\n msg_1 = 'high';\n break;\n case 2:\n msg_1 = 'medium';\n break;\n case 4:\n msg_1 = 'low';\n break;\n default:\n msg_1 = 'auto';\n}\nmsg.payload = msg_1\nmsg.topic = "homeassistant/climate/zhonghong/1-1/fan/state";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":500,"wires":[["1b03feb66e13c417"]]},{"id":"50b4f45eb615ae6f","type":"mqtt out","z":"5ae3ca12152d6384","name":"temp/state","topic":"","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"cc150b3a.bacbc8","x":810,"y":380,"wires":[]},{"id":"273ce04bd36d52cb","type":"mqtt out","z":"5ae3ca12152d6384","name":"mode/state","topic":"","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"cc150b3a.bacbc8","x":810,"y":440,"wires":[]},{"id":"1b03feb66e13c417","type":"mqtt out","z":"5ae3ca12152d6384","name":"fan/state","topic":"","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"cc150b3a.bacbc8","x":800,"y":500,"wires":[]},{"id":"7e689472fa890182","type":"modbus-client","name":"日立空调网关","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"failureLogEnabled":true,"tcpHost":"10.1.200.248","tcpPort":"1030","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true,"showWarnings":true,"showLogs":true},{"id":"cc150b3a.bacbc8","type":"mqtt-broker","name":"","broker":"10.1.200.251","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]