tnx so far.
something is working ...
for now it looks like only the mode is not working ... in both directions ...
Code: Select all
[{"id":"f8735c63.2bce68","type":"mqtt in","z":"368ce178.20b30e","name":"","topic":"myhome/topic/#","qos":"0","datatype":"auto","broker":"2cb31592.9db462","x":160,"y":260,"wires":[["eb4e19ba.25f958"]]},{"id":"6cbef17.484a91","type":"debug","z":"368ce178.20b30e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":200,"wires":[]},{"id":"eb4e19ba.25f958","type":"function","z":"368ce178.20b30e","name":"To Domoticz","func":"switch (msg.topic) {\n\n case \"myhome/topic/Fresh\":\n msg.payload = {\"command\":\"switchlight\",\"idx\":246,\"switchcmd\":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};\n break;\n \n case \"myhome/topic/Lock_Remote\":\n if (msg.payload == \"true\") {\n msg.payload = {\"command\":\"switchlight\",\"idx\":247,\"switchcmd\":\"On\"};\n } else if (msg.payload == \"false\") {\n msg.payload = {\"command\":\"switchlight\",\"idx\":247,\"switchcmd\":\"Off\"};\n }\n break;\n \n case \"myhome/topic/Power\":\n msg.payload = {\"command\":\"switchlight\",\"idx\":248,\"switchcmd\":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};\n break;\n \n case \"myhome/topic/Health\":\n msg.payload = {\"command\":\"switchlight\",\"idx\":249,\"switchcmd\":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};\n break;\n \n case \"myhome/topic/Compressor\":\n msg.payload = {\"command\":\"switchlight\",\"idx\":250,\"switchcmd\":msg.payload.charAt(0).toUpperCase() + msg.payload.slice(1)};\n break;\n \n case \"myhome/topic/Swing\": \n \n switch (msg.payload) {\n\n case \"off\":\n msg.payload = {\"command\":\"udevice\",\"idx\":251,\"nvalue\":1,\"svalue\":\"0\"};\n break;\n \n case \"ud\":\n msg.payload = {\"command\":\"udevice\",\"idx\":251,\"nvalue\":1,\"svalue\":\"10\"};\n break;\n\n case \"lr\":\n msg.payload = {\"command\":\"udevice\",\"idx\":251,\"nvalue\":1,\"svalue\":\"20\"};\n break;\n\n case \"all\":\n msg.payload = {\"command\":\"udevice\",\"idx\":251,\"nvalue\":1,\"svalue\":\"30\"};\n break;\n\n }\n break;\n \n case \"myhome/topic/Fan_Speed\": \n \n switch (msg.payload) {\n\n case \"max\":\n msg.payload = {\"command\":\"udevice\",\"idx\":252,\"nvalue\":1,\"svalue\":\"10\"};\n break;\n \n case \"mid\":\n msg.payload = {\"command\":\"udevice\",\"idx\":252,\"nvalue\":1,\"svalue\":\"20\"};\n break;\n\n case \"min\":\n msg.payload = {\"command\":\"udevice\",\"idx\":252,\"nvalue\":1,\"svalue\":\"30\"};\n break;\n\n case \"auto\":\n msg.payload = {\"command\":\"udevice\",\"idx\":252,\"nvalue\":1,\"svalue\":\"40\"};\n break;\n\n }\n break;\n \n case \"myhome/topic/Mode\": \n \n switch (msg.payload) {\n\n case \"off\":\n msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"0\"};\n break;\n \n case \"dry\":\n msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"10\"};\n break;\n\n case \"fan_only\":\n msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"20\"};\n break;\n\n case \"heat\":\n msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"30\"};\n break;\n\n case \"cool\":\n msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"40\"};\n break;\n\n case \"auto\":\n msg.payload = {\"command\":\"udevice\",\"idx\":255,\"nvalue\":1,\"svalue\":\"50\"};\n break;\n\n }\n break;\n \n case \"myhome/topic/Set_Temp\":\n msg.payload = {\"command\":\"udevice\",\"idx\":253,\"nvalue\":0,\"svalue\":msg.payload};\n break; \n \n case \"myhome/topic/Current_Temp\":\n msg.payload = {\"command\":\"udevice\",\"idx\":254,\"nvalue\":0,\"svalue\":msg.payload};\n break;\n \n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":260,"wires":[["6cbef17.484a91","50b3a84a.5006c8"]]},{"id":"50b3a84a.5006c8","type":"mqtt out","z":"368ce178.20b30e","name":"","topic":"domoticz/in","qos":"0","retain":"false","broker":"2cb31592.9db462","x":570,"y":260,"wires":[]},{"id":"4996743f.5b86c4","type":"mqtt in","z":"368ce178.20b30e","name":"","topic":"domoticz/out","qos":"2","datatype":"json","broker":"183fcf3a.ecc671","x":150,"y":420,"wires":[["a33fe4a5.8e401"]]},{"id":"a33fe4a5.8e401","type":"switch","z":"368ce178.20b30e","name":"Filter Haier Commands","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"247","vt":"num"},{"t":"eq","v":"248","vt":"num"},{"t":"eq","v":"249","vt":"num"},{"t":"eq","v":"251","vt":"num"},{"t":"eq","v":"252","vt":"num"},{"t":"eq","v":"254","vt":"num"},{"t":"eq","v":"255","vt":"num"}],"checkall":"true","repair":false,"outputs":7,"x":390,"y":420,"wires":[["2defd0dd.92e31"],["2634997.53e41e6"],["6306c0e2.ef5d68"],["2d4fea47.dddd56"],["bbd2e04a.11a628"],["aebe0539.a29f8"],["2ac9aaf1.d3387e"]]},{"id":"7b3b385e.d39d5","type":"comment","z":"368ce178.20b30e","name":"Output explanation","info":"1. Lock Remote\n2. Power\n3. Health\n4. Swing\n5. Fan Speed\n6. Mode\n7. Thermostat Setpoint","x":370,"y":520,"wires":[]},{"id":"2defd0dd.92e31","type":"function","z":"368ce178.20b30e","name":"Lock Remote","func":"msg.topic = \"myhome/topic/set/Lock_Remote\";\nmsg.payload = msg.payload.nvalue.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660,"y":320,"wires":[["1d8d5884.6d6edf"]]},{"id":"2634997.53e41e6","type":"function","z":"368ce178.20b30e","name":"Power","func":"msg.topic = \"myhome/topic/set/Power\";\nmsg.payload = msg.payload.nvalue.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":630,"y":360,"wires":[["1d8d5884.6d6edf"]]},{"id":"6306c0e2.ef5d68","type":"function","z":"368ce178.20b30e","name":"Health","func":"msg.topic = \"myhome/topic/set/Health\";\nmsg.payload = msg.payload.nvalue.toString();\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":630,"y":400,"wires":[["1d8d5884.6d6edf"]]},{"id":"2d4fea47.dddd56","type":"function","z":"368ce178.20b30e","name":"Swing","func":"msg.topic = \"myhome/topic/set/Swing\";\nif ((msg.payload.nvalue === 0) && msg.payload.svalue1 == \"0\") {\n msg.payload = \"off\";\n} else if (msg.payload.nvalue === 2) {\n switch (msg.payload.svalue1) {\n case \"10\":\n msg.payload = \"ud\";\n break;\n \n case \"20\":\n msg.payload = \"lr\";\n break;\n\n case \"30\":\n msg.payload = \"all\";\n break;\n\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":630,"y":440,"wires":[["1d8d5884.6d6edf"]]},{"id":"bbd2e04a.11a628","type":"function","z":"368ce178.20b30e","name":"Fan Speed","func":"msg.topic = \"myhome/topic/set/Fan_Speed\";\nif (msg.payload.nvalue === 2) {\n switch (msg.payload.svalue1) {\n case \"10\":\n msg.payload = \"max\";\n break;\n \n case \"20\":\n msg.payload = \"mid\";\n break;\n\n case \"30\":\n msg.payload = \"min\";\n break;\n\n case \"40\":\n msg.payload = \"auto\";\n break;\n\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":480,"wires":[["1d8d5884.6d6edf"]]},{"id":"aebe0539.a29f8","type":"function","z":"368ce178.20b30e","name":"Mode","func":"msg.topic = \"myhome/topic/set/Mode\";\nif ((msg.payload.nvalue === 0) && msg.payload.svalue1 == \"0\") {\n msg.payload = \"off\";\n} else if (msg.payload.nvalue === 2) {\n switch (msg.payload.svalue1) {\n case \"10\":\n msg.payload = \"dry\";\n break;\n \n case \"20\":\n msg.payload = \"fan_only\";\n break;\n\n case \"30\":\n msg.payload = \"heat\";\n break;\n \n case \"40\":\n msg.payload = \"cool\";\n break;\n\n case \"50\":\n msg.payload = \"auto\";\n break;\n\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":630,"y":520,"wires":[["1d8d5884.6d6edf"]]},{"id":"2ac9aaf1.d3387e","type":"function","z":"368ce178.20b30e","name":"Set Temperature","func":"msg.topic = \"myhome/topic/set/Set_Temp\";\nmsg.payload = msg.payload.svalue1;\nif (Number(msg.payload) < 16) (msg.payload) = \"16.00\";\nif (Number(msg.payload) > 30) (msg.payload) = \"30.00\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660,"y":560,"wires":[["1d8d5884.6d6edf"]]},{"id":"1d8d5884.6d6edf","type":"mqtt out","z":"368ce178.20b30e","name":"MQTT to Haier","topic":"","qos":"0","retain":"false","broker":"2cb31592.9db462","x":960,"y":420,"wires":[]},{"id":"2cb31592.9db462","type":"mqtt-broker","z":"","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"183fcf3a.ecc671","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
is what I loaded now.