[
    {
        "id": "707eb3c703a83bdf",
        "type": "tab",
        "label": "fabacademy",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "7531f49b185887ca",
        "type": "mqtt out",
        "z": "707eb3c703a83bdf",
        "name": "",
        "topic": "fabacademy/grupo/sensores/uno",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "d3d89333c49e79c6",
        "x": 460,
        "y": 140,
        "wires": []
    },
    {
        "id": "6bcc531aa7c35f55",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 150,
        "y": 140,
        "wires": [
            [
                "7531f49b185887ca"
            ]
        ]
    },
    {
        "id": "8cc80fcd3a1e1f16",
        "type": "mqtt in",
        "z": "707eb3c703a83bdf",
        "name": "",
        "topic": "fabacademy/grupo/fotovoltaica",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "d3d89333c49e79c6",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 250,
        "y": 240,
        "wires": [
            []
        ]
    },
    {
        "id": "0d688d162b7fb7c1",
        "type": "debug",
        "z": "707eb3c703a83bdf",
        "name": "debug 34",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 480,
        "y": 240,
        "wires": []
    },
    {
        "id": "eaef4ca2a0bc2555",
        "type": "debug",
        "z": "707eb3c703a83bdf",
        "name": "debug 35",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 540,
        "y": 320,
        "wires": []
    },
    {
        "id": "03d14ed453dba2b2",
        "type": "mqtt in",
        "z": "707eb3c703a83bdf",
        "name": "",
        "topic": "fabacademy/grupo/consumo",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "d3d89333c49e79c6",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 220,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "81ca3ea82ba325b6",
        "type": "debug",
        "z": "707eb3c703a83bdf",
        "name": "debug 37",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 560,
        "y": 380,
        "wires": []
    },
    {
        "id": "764e35a4c4e57a6f",
        "type": "mqtt in",
        "z": "707eb3c703a83bdf",
        "name": "",
        "topic": "fabacademy/grupo/temperatura",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "d3d89333c49e79c6",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 250,
        "y": 380,
        "wires": [
            []
        ]
    },
    {
        "id": "70a35d114a8dfde4",
        "type": "mqtt in",
        "z": "707eb3c703a83bdf",
        "name": "",
        "topic": "xiao/mensaje",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "edfb10176aa5e617",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 190,
        "y": 460,
        "wires": [
            [
                "167afe07b21bc573"
            ]
        ]
    },
    {
        "id": "167afe07b21bc573",
        "type": "debug",
        "z": "707eb3c703a83bdf",
        "name": "debug 56",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 460,
        "y": 460,
        "wires": []
    },
    {
        "id": "041bb7edc22764b8",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "green",
        "payloadType": "str",
        "x": 270,
        "y": 560,
        "wires": [
            [
                "be543abed4889a2e"
            ]
        ]
    },
    {
        "id": "be543abed4889a2e",
        "type": "mqtt out",
        "z": "707eb3c703a83bdf",
        "name": "fabacademy",
        "topic": "xiao/servo",
        "qos": "0",
        "retain": "true",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "edfb10176aa5e617",
        "x": 1350,
        "y": 620,
        "wires": []
    },
    {
        "id": "b957869340decff4",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "off",
        "payloadType": "str",
        "x": 250,
        "y": 620,
        "wires": [
            [
                "be543abed4889a2e"
            ]
        ]
    },
    {
        "id": "5304bffc65d7974a",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "red",
        "payloadType": "str",
        "x": 270,
        "y": 520,
        "wires": [
            [
                "be543abed4889a2e"
            ]
        ]
    },
    {
        "id": "1c4422c7c8ac744d",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "normal",
        "payloadType": "str",
        "x": 290,
        "y": 720,
        "wires": [
            [
                "be543abed4889a2e"
            ]
        ]
    },
    {
        "id": "ccaea4361c9ff564",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "wite",
        "payloadType": "str",
        "x": 210,
        "y": 680,
        "wires": [
            [
                "be543abed4889a2e"
            ]
        ]
    },
    {
        "id": "a53ba3aa29114545",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "blink",
        "payloadType": "str",
        "x": 210,
        "y": 780,
        "wires": [
            [
                "be543abed4889a2e",
                "ea667388e7105cdc"
            ]
        ]
    },
    {
        "id": "de6f0b9625ae98ab",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "talk",
        "payloadType": "str",
        "x": 470,
        "y": 720,
        "wires": [
            [
                "be543abed4889a2e"
            ]
        ]
    },
    {
        "id": "b30e7187eb46f1e8",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "eyes_blue",
        "payloadType": "str",
        "x": 440,
        "y": 800,
        "wires": [
            [
                "be543abed4889a2e"
            ]
        ]
    },
    {
        "id": "2ff1d071a41b6160",
        "type": "mqtt in",
        "z": "707eb3c703a83bdf",
        "name": "",
        "topic": "xiao/distancia",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "edfb10176aa5e617",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 270,
        "y": 920,
        "wires": [
            [
                "79509a01a4efc89f",
                "72408477dba77952"
            ]
        ]
    },
    {
        "id": "386f279d8cba9a67",
        "type": "mqtt in",
        "z": "707eb3c703a83bdf",
        "name": "",
        "topic": "atom/estado",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "edfb10176aa5e617",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 330,
        "y": 1400,
        "wires": [
            []
        ]
    },
    {
        "id": "79509a01a4efc89f",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "function 40",
        "func": "msg.payload = msg.payload.distancia_m;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 450,
        "y": 920,
        "wires": [
            [
                "6a6e23729cf3281c"
            ]
        ]
    },
    {
        "id": "6a6e23729cf3281c",
        "type": "mqtt out",
        "z": "707eb3c703a83bdf",
        "name": "fabacademy",
        "topic": "atom/metros",
        "qos": "0",
        "retain": "true",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "edfb10176aa5e617",
        "x": 710,
        "y": 880,
        "wires": []
    },
    {
        "id": "3688ec7cdb022742",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 270,
        "y": 860,
        "wires": [
            [
                "2587473dbbfb6879"
            ]
        ]
    },
    {
        "id": "2587473dbbfb6879",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "function 41",
        "func": "msg.payload=\" \";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 860,
        "wires": [
            [
                "6a6e23729cf3281c"
            ]
        ]
    },
    {
        "id": "12bd58133f4d501a",
        "type": "mqtt out",
        "z": "707eb3c703a83bdf",
        "name": "fabacademy",
        "topic": "atom/servo",
        "qos": "0",
        "retain": "true",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "edfb10176aa5e617",
        "x": 710,
        "y": 1500,
        "wires": []
    },
    {
        "id": "1ea1173852f3b8a1",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "abrir puerta",
        "func": "msg.payload=\"open\";\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 470,
        "y": 1500,
        "wires": [
            [
                "12bd58133f4d501a"
            ]
        ]
    },
    {
        "id": "de73dfb2a688505c",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "cerrar puerta",
        "func": "msg.payload=\"close\";\n\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 470,
        "y": 1560,
        "wires": [
            [
                "12bd58133f4d501a"
            ]
        ]
    },
    {
        "id": "be53d98e5667c4f4",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 190,
        "y": 1480,
        "wires": [
            [
                "1ea1173852f3b8a1"
            ]
        ]
    },
    {
        "id": "4afe5e6bf6b6c4cf",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 130,
        "y": 1540,
        "wires": [
            [
                "de73dfb2a688505c"
            ]
        ]
    },
    {
        "id": "8ed2907a12cbf46c",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "automático abrir",
        "func": "// Leer variable de flujo\nvar automatico = flow.get(\"automatico\");\n\n// Leer distancia recibida\nvar distancia = Number(msg.payload);\n\n// Solo actúa si automático está en 1\nif (automatico == 1) {\n\n   // if (distancia < 1.5) {\n   //     if (distancia >0.4) {\n   //     msg.payload = \"open\";\n    //} \n    msg.payload = \"open\";\n    } \n\n  \n\n    return msg;\n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 960,
        "y": 1040,
        "wires": [
            [
                "f34e47ac8b84d0df",
                "b8583aa047815bdd",
                "0dee7949b4ec7c85",
                "4c84272ccb8ee3b5",
                "e803acd90433f6a4",
                "ad9d325352efc2f7",
                "8d0b1759dbad2896",
                "3c9ef91968e3c0e5",
                "54279b08377e6602"
            ]
        ]
    },
    {
        "id": "f34e47ac8b84d0df",
        "type": "mqtt out",
        "z": "707eb3c703a83bdf",
        "name": "fabacademy",
        "topic": "fabi/puerta/open",
        "qos": "0",
        "retain": "true",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "edfb10176aa5e617",
        "x": 1230,
        "y": 1020,
        "wires": []
    },
    {
        "id": "4edb2bf5c133c57b",
        "type": "mqtt in",
        "z": "707eb3c703a83bdf",
        "name": "",
        "topic": "fabi/automatico",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "edfb10176aa5e617",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 480,
        "y": 1300,
        "wires": [
            [
                "e92c3ab3983e69cf",
                "b7505fe9873e2b21"
            ]
        ]
    },
    {
        "id": "e92c3ab3983e69cf",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "function 20",
        "func": "flow.set(\"automatico\", msg.payload);\n\nreturn msg;\n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 730,
        "y": 1440,
        "wires": [
            []
        ]
    },
    {
        "id": "c62948581a6220b2",
        "type": "mqtt in",
        "z": "707eb3c703a83bdf",
        "name": "",
        "topic": "fabi/puerta/open",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "edfb10176aa5e617",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 300,
        "y": 1460,
        "wires": [
            [
                "1ea1173852f3b8a1"
            ]
        ]
    },
    {
        "id": "4511271a33e03313",
        "type": "mqtt in",
        "z": "707eb3c703a83bdf",
        "name": "",
        "topic": "fabi/puerta/close",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "edfb10176aa5e617",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 295,
        "y": 1580,
        "wires": [
            [
                "de73dfb2a688505c"
            ]
        ]
    },
    {
        "id": "ea667388e7105cdc",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "function 21",
        "func": "// Leer variable de flujo\nvar automatico = flow.get(\"automatico\");\n\n// Leer distancia recibida\nvar distancia = Number(msg.payload);\n\n// Solo actúa si automático está en 1\nif (automatico == 1) {\n\n    if (distancia < 1.5) {\n        msg.payload = \"blink\";\n    } \n\n  \n\n    return msg;\n}\n\n// Si automático no está activo, no envía nada\nreturn null;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 810,
        "y": 680,
        "wires": [
            [
                "be543abed4889a2e"
            ]
        ]
    },
    {
        "id": "2be8eaf9c8edd333",
        "type": "mqtt out",
        "z": "707eb3c703a83bdf",
        "name": "fabacademy",
        "topic": "fabi/puerta/close",
        "qos": "0",
        "retain": "true",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "edfb10176aa5e617",
        "x": 1350,
        "y": 1500,
        "wires": []
    },
    {
        "id": "72408477dba77952",
        "type": "debug",
        "z": "707eb3c703a83bdf",
        "name": "debug 41",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 440,
        "y": 960,
        "wires": []
    },
    {
        "id": "1649cd5354e2672c",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "arriba2",
        "func": "msg.payload = { motor: 2, steps: 40000, speed: 5000 };\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1320,
        "y": 1140,
        "wires": [
            [
                "969bafe9fd98299b"
            ]
        ]
    },
    {
        "id": "969bafe9fd98299b",
        "type": "mqtt out",
        "z": "707eb3c703a83bdf",
        "name": "fabacademy",
        "topic": "atom/motores",
        "qos": "0",
        "retain": "true",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "edfb10176aa5e617",
        "x": 1430,
        "y": 1060,
        "wires": []
    },
    {
        "id": "b8583aa047815bdd",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "arriba",
        "func": "msg.payload = { motor: 1, steps: -40000, speed: 5000 };\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1230,
        "y": 1080,
        "wires": [
            [
                "969bafe9fd98299b"
            ]
        ]
    },
    {
        "id": "0dee7949b4ec7c85",
        "type": "delay",
        "z": "707eb3c703a83bdf",
        "name": "",
        "pauseType": "delay",
        "timeout": "1",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1160,
        "y": 1160,
        "wires": [
            [
                "1649cd5354e2672c"
            ]
        ]
    },
    {
        "id": "c4de40c3e76b8741",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 810,
        "y": 1180,
        "wires": [
            [
                "b8583aa047815bdd",
                "0dee7949b4ec7c85"
            ]
        ]
    },
    {
        "id": "237b7499e1513fb5",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "abajo2",
        "func": "msg.payload = { motor: 2, steps: -40000, speed: 5000 };\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1190,
        "y": 1380,
        "wires": [
            [
                "7588c2656bb88758"
            ]
        ]
    },
    {
        "id": "7588c2656bb88758",
        "type": "mqtt out",
        "z": "707eb3c703a83bdf",
        "name": "fabacademy",
        "topic": "atom/motores",
        "qos": "0",
        "retain": "true",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "edfb10176aa5e617",
        "x": 1450,
        "y": 1340,
        "wires": []
    },
    {
        "id": "6f05c415ae9f6ea9",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "abajo1",
        "func": "msg.payload = { motor: 1, steps: 40000, speed: 5000 };\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1190,
        "y": 1320,
        "wires": [
            [
                "7588c2656bb88758"
            ]
        ]
    },
    {
        "id": "bb9f82173762e326",
        "type": "delay",
        "z": "707eb3c703a83bdf",
        "name": "",
        "pauseType": "delay",
        "timeout": "1",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1020,
        "y": 1400,
        "wires": [
            [
                "237b7499e1513fb5"
            ]
        ]
    },
    {
        "id": "f30fc06aa13292b8",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 810,
        "y": 1320,
        "wires": [
            [
                "6f05c415ae9f6ea9",
                "bb9f82173762e326"
            ]
        ]
    },
    {
        "id": "554523c7a4113ea3",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "function 26",
        "func": "// Leer variable de flujo\nvar automatico = flow.get(\"automatico\");\n\n// Leer distancia recibida\nvar distancia = Number(msg.payload);\n\n// Solo actúa si automático está en 1\nif (automatico == 0) {\n\n   // if (distancia < 1.5) {\n   //     if (distancia >0.4) {\n   //     msg.payload = \"open\";\n    //} \n    msg.payload = \"close\";\n    } \n\n  \n\n    return msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1070,
        "y": 1500,
        "wires": [
            [
                "2be8eaf9c8edd333",
                "6f05c415ae9f6ea9",
                "bb9f82173762e326"
            ]
        ]
    },
    {
        "id": "b7505fe9873e2b21",
        "type": "switch",
        "z": "707eb3c703a83bdf",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "0",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 790,
        "y": 1260,
        "wires": [
            [
                "8ed2907a12cbf46c"
            ],
            [
                "554523c7a4113ea3",
                "25ea4b845c4f8554"
            ]
        ]
    },
    {
        "id": "9a42e7f257aeb44e",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "function 22",
        "func": "msg.payload=\"blink\";\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1210,
        "y": 680,
        "wires": [
            [
                "be543abed4889a2e"
            ]
        ]
    },
    {
        "id": "4c84272ccb8ee3b5",
        "type": "delay",
        "z": "707eb3c703a83bdf",
        "name": "",
        "pauseType": "delay",
        "timeout": "3",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1040,
        "y": 700,
        "wires": [
            [
                "9a42e7f257aeb44e"
            ]
        ]
    },
    {
        "id": "e803acd90433f6a4",
        "type": "delay",
        "z": "707eb3c703a83bdf",
        "name": "",
        "pauseType": "delay",
        "timeout": "6",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1060,
        "y": 740,
        "wires": [
            [
                "9a42e7f257aeb44e"
            ]
        ]
    },
    {
        "id": "ad9d325352efc2f7",
        "type": "delay",
        "z": "707eb3c703a83bdf",
        "name": "",
        "pauseType": "delay",
        "timeout": "9",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1060,
        "y": 800,
        "wires": [
            [
                "9a42e7f257aeb44e"
            ]
        ]
    },
    {
        "id": "8d0b1759dbad2896",
        "type": "delay",
        "z": "707eb3c703a83bdf",
        "name": "",
        "pauseType": "delay",
        "timeout": "14",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1077,
        "y": 853,
        "wires": [
            [
                "9a42e7f257aeb44e"
            ]
        ]
    },
    {
        "id": "c2b62c96f51362b3",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "function 23",
        "func": "msg.payload=\"talk\";\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1310,
        "y": 800,
        "wires": [
            [
                "be543abed4889a2e"
            ]
        ]
    },
    {
        "id": "3c9ef91968e3c0e5",
        "type": "delay",
        "z": "707eb3c703a83bdf",
        "name": "",
        "pauseType": "delay",
        "timeout": "16",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1090,
        "y": 900,
        "wires": [
            [
                "c2b62c96f51362b3"
            ]
        ]
    },
    {
        "id": "54279b08377e6602",
        "type": "delay",
        "z": "707eb3c703a83bdf",
        "name": "",
        "pauseType": "delay",
        "timeout": "17",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1130,
        "y": 940,
        "wires": [
            [
                "c2b62c96f51362b3",
                "083a5ad2c2e0eb53"
            ]
        ]
    },
    {
        "id": "083a5ad2c2e0eb53",
        "type": "delay",
        "z": "707eb3c703a83bdf",
        "name": "",
        "pauseType": "delay",
        "timeout": "1",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1280,
        "y": 940,
        "wires": [
            [
                "c2b62c96f51362b3"
            ]
        ]
    },
    {
        "id": "25ea4b845c4f8554",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "function 24",
        "func": "msg.payload=\"green\";\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1170,
        "y": 1260,
        "wires": [
            [
                "be543abed4889a2e"
            ]
        ]
    },
    {
        "id": "6ad7edb81aa2245f",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "abajo",
        "func": "msg.payload = { motor: 1, steps: 5000, speed: 5000 };\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1890,
        "y": 880,
        "wires": [
            [
                "99676ddc386b8b72"
            ]
        ]
    },
    {
        "id": "6b863530dd73cda7",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 1670,
        "y": 880,
        "wires": [
            [
                "6ad7edb81aa2245f"
            ]
        ]
    },
    {
        "id": "a085a32ab8b8a996",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 1670,
        "y": 820,
        "wires": [
            [
                "77f4705a3eef2306"
            ]
        ]
    },
    {
        "id": "77f4705a3eef2306",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "arriba",
        "func": "msg.payload = { motor: 1, steps: -5000, speed: 5000 };\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1870,
        "y": 820,
        "wires": [
            [
                "99676ddc386b8b72"
            ]
        ]
    },
    {
        "id": "99676ddc386b8b72",
        "type": "mqtt out",
        "z": "707eb3c703a83bdf",
        "name": "fabacademy",
        "topic": "atom/motores",
        "qos": "0",
        "retain": "true",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "edfb10176aa5e617",
        "x": 2050,
        "y": 900,
        "wires": []
    },
    {
        "id": "52d1d471fbba03e8",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "arriba",
        "func": "msg.payload = { motor: 2, steps: 5000, speed: 5000 };\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1855,
        "y": 937,
        "wires": [
            [
                "99676ddc386b8b72"
            ]
        ]
    },
    {
        "id": "2262843fd0f8c631",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 1670,
        "y": 940,
        "wires": [
            [
                "52d1d471fbba03e8"
            ]
        ]
    },
    {
        "id": "382ac604446a21d3",
        "type": "function",
        "z": "707eb3c703a83bdf",
        "name": "abajo",
        "func": "msg.payload = { motor: 2, steps: -5000, speed: 5000 };\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1850,
        "y": 980,
        "wires": [
            [
                "99676ddc386b8b72"
            ]
        ]
    },
    {
        "id": "46c940ef1947cbe6",
        "type": "inject",
        "z": "707eb3c703a83bdf",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 1650,
        "y": 980,
        "wires": [
            [
                "382ac604446a21d3"
            ]
        ]
    },
    {
        "id": "d3d89333c49e79c6",
        "type": "mqtt-broker",
        "name": "mqttabierto",
        "broker": "89.116.24.168",
        "port": "31160",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": 4,
        "keepalive": 60,
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closeRetain": "false",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    },
    {
        "id": "edfb10176aa5e617",
        "type": "mqtt-broker",
        "name": "mqttredytel 2",
        "broker": "89.116.24.168",
        "port": "31160",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]