[ { "id": "74dddd1.aeae324", "type": "inject", "z": "6627d8cd.92ef5", "name": "", "topic": "", "payload": "246F28AA380C", "payloadType": "str", "repeat": "", "crontab": "", "once": true, "onceDelay": 0.1, "x": 120, "y": 60, "wires": [ [ "6182a618.62da6" ] ] }, { "id": "6182a618.62da6", "type": "function", "z": "6627d8cd.92ef5", "name": "--> MAC + Topics", "func": "flow.set(\"MAC\",msg.payload)\nflow.set(\"TOPIC_LATCHING_RELAY\",\"/\"+msg.payload + \"/latchingRelay\")\nflow.set(\"TOPIC_BT_I35\",\"/\"+msg.payload + \"/btI35\")\nmsg.payload = flow.get(\"TOPIC_BT_I35\")\nflow.set(\"TOPIC_BT_I34\",\"/\"+msg.payload + \"/btI34\")\nmsg.payload = flow.get(\"TOPIC_BT_I34\")\nflow.set(\"TOPIC_BT_IO0\",\"/\"+msg.payload + \"/btIO0\")\nmsg.payload = flow.get(\"TOPIC_BT_IO0\")\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 330, "y": 60, "wires": [ [ "972c67ef.9cdcd8" ] ] }, { "id": "c5725ecd.276ee8", "type": "inject", "z": "6627d8cd.92ef5", "name": "", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 100, "y": 120, "wires": [ [ "be7ca639.9fd16" ] ] }, { "id": "be7ca639.9fd16", "type": "function", "z": "6627d8cd.92ef5", "name": "MAC -->", "func": "var MAC = flow.get(\"MAC\");\nmsg.payload = MAC;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 300, "y": 120, "wires": [ [ "972c67ef.9cdcd8" ] ] }, { "id": "972c67ef.9cdcd8", "type": "debug", "z": "6627d8cd.92ef5", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 530, "y": 120, "wires": [] }, { "id": "9433f71b.cf84c8", "type": "mqtt in", "z": "6627d8cd.92ef5", "name": "", "topic": "#", "qos": "2", "broker": "2640d603.56aa6a", "x": 70, "y": 220, "wires": [ [ "3f6fa5e6.48aa32", "e64b335d.2e7fe" ] ] }, { "id": "3f6fa5e6.48aa32", "type": "function", "z": "6627d8cd.92ef5", "name": "if it is my MAC -->", "func": "var MAC = flow.get(\"MAC\");\nvar topic = String(msg.topic);\n\nif (topic.indexOf(MAC) !== -1)\n return msg;\n", "outputs": 1, "noerr": 0, "x": 330, "y": 220, "wires": [ [ "392853fe.ccd8d4" ] ] }, { "id": "f9a1499d.0e28c", "type": "debug", "z": "6627d8cd.92ef5", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 530, "y": 280, "wires": [] }, { "id": "e64b335d.2e7fe", "type": "function", "z": "6627d8cd.92ef5", "name": "topic,payload", "func": "\nreturn [{payload: msg.topic},msg];", "outputs": 2, "noerr": 0, "x": 340, "y": 300, "wires": [ [ "f9a1499d.0e28c" ], [ "1e706058.63029" ] ] }, { "id": "1e706058.63029", "type": "debug", "z": "6627d8cd.92ef5", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 530, "y": 320, "wires": [] }, { "id": "2a37aaba.670f86", "type": "debug", "z": "6627d8cd.92ef5", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 750, "y": 220, "wires": [] }, { "id": "392853fe.ccd8d4", "type": "function", "z": "6627d8cd.92ef5", "name": "TOPIC_BT_I35 -->", "func": "var MAC = flow.get(\"MAC\");\nvar topic = String(msg.topic);\nvar topic_BT_I35 = flow.get(\"TOPIC_BT_I35\");\n\nif (topic === topic_BT_I35)\n return msg;\n", "outputs": 1, "noerr": 0, "x": 550, "y": 220, "wires": [ [ "2a37aaba.670f86" ] ] }, { "id": "2640d603.56aa6a", "type": "mqtt-broker", "z": "", "name": "", "broker": "iot.siarq.net", "port": "8883", "tls": "", "clientid": "", "usetls": true, "compatmode": true, "keepalive": "60", "cleansession": true, "birthTopic": "", "birthQos": "0", "birthPayload": "", "closeTopic": "", "closeQos": "0", "closePayload": "", "willTopic": "", "willQos": "0", "willPayload": "" } ]