﻿[
  {
    "id": "c8f60bcb.323ce8",
    "type": "subflow",
    "name": "RM Get",
    "info": "",
    "in": [
      {
        "x": 140,
        "y": 140,
        "wires": [ { "id": "2b911716.f52e78" } ]
      }
    ],
    "out": [
      {
        "x": 560,
        "y": 260,
        "wires": [
          {
            "id": "54a58bb8.c5cd84",
            "port": 0
          }
        ]
      }
    ]
  },
  {
    "id": "76f938f7.283d48",
    "type": "file in",
    "z": "c8f60bcb.323ce8",
    "name": "",
    "filename": "",
    "format": "utf8",
    "x": 350,
    "y": 140,
    "wires": [ [ "8a6c75f0.ec1418" ] ]
  },
  {
    "id": "2b911716.f52e78",
    "type": "function",
    "z": "c8f60bcb.323ce8",
    "name": "",
    "func": "msg.filename=msg.folder+\"jsonSubIr\";\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 230,
    "y": 140,
    "wires": [ [ "76f938f7.283d48" ] ]
  },
  {
    "id": "8a6c75f0.ec1418",
    "type": "json",
    "z": "c8f60bcb.323ce8",
    "name": "",
    "x": 470,
    "y": 140,
    "wires": [ [ "de953cfb.75626" ] ]
  },
  {
    "id": "de953cfb.75626",
    "type": "function",
    "z": "c8f60bcb.323ce8",
    "name": "",
    "func": "msg.remoteid=msg.payload.filter(function (obj) { if (obj.name == msg.remote) { return true; } })[0].id;\nmsg.filename=msg.folder+\"jsonButton\";\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 230,
    "y": 180,
    "wires": [ [ "e1444aed.1c6c28" ] ]
  },
  {
    "id": "e1444aed.1c6c28",
    "type": "file in",
    "z": "c8f60bcb.323ce8",
    "name": "",
    "filename": "",
    "format": "utf8",
    "x": 350,
    "y": 180,
    "wires": [ [ "36aeb698.9280ba" ] ]
  },
  {
    "id": "36aeb698.9280ba",
    "type": "json",
    "z": "c8f60bcb.323ce8",
    "name": "",
    "x": 470,
    "y": 180,
    "wires": [ [ "a5e957e.08c63a8" ] ]
  },
  {
    "id": "a5e957e.08c63a8",
    "type": "function",
    "z": "c8f60bcb.323ce8",
    "name": "",
    "func": "msg.buttonid=msg.payload.filter(function (obj) { if (obj.name == msg.button && obj.subIRId == msg.remoteid) { return true; } })[0].id;\nmsg.filename=msg.folder+\"jsonIrCode\";\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 230,
    "y": 220,
    "wires": [ [ "8216cd6a.695a1" ] ]
  },
  {
    "id": "8216cd6a.695a1",
    "type": "file in",
    "z": "c8f60bcb.323ce8",
    "name": "",
    "filename": "",
    "format": "utf8",
    "x": 350,
    "y": 220,
    "wires": [ [ "f041d37.141f63" ] ]
  },
  {
    "id": "f041d37.141f63",
    "type": "json",
    "z": "c8f60bcb.323ce8",
    "name": "",
    "x": 470,
    "y": 220,
    "wires": [ [ "54a58bb8.c5cd84" ] ]
  },
  {
    "id": "54a58bb8.c5cd84",
    "type": "function",
    "z": "c8f60bcb.323ce8",
    "name": "",
    "func": "var data=msg.payload.filter(function (obj) { if (obj.buttonId == msg.buttonid) { return true; } })[0].code;\ndelete msg.filename;\ndelete msg.folder;\nmsg.payload = {};\nmsg.payload.action='send';\nmsg.payload.data=data;\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 230,
    "y": 260,
    "wires": [ [] ]
  },
  {
    "id": "7ac8e0e7.fd804",
    "type": "subflow:c8f60bcb.323ce8",
    "z": "37e3d071.a4e02",
    "name": "",
    "x": 1100,
    "y": 1140,
    "wires": [ [ "5131180.d409ee8" ] ]
  },
  {
    "id": "c5d20bd6.691388",
    "type": "inject",
    "z": "37e3d071.a4e02",
    "name": "",
    "topic": "",
    "payload": "",
    "payloadType": "str",
    "repeat": "",
    "crontab": "",
    "once": false,
    "x": 770,
    "y": 1140,
    "wires": [ [ "30f1f826.f06048" ] ]
  },
  {
    "id": "5131180.d409ee8",
    "type": "debug",
    "z": "37e3d071.a4e02",
    "name": "",
    "active": true,
    "console": "false",
    "complete": "true",
    "x": 1230,
    "y": 1140,
    "wires": []
  },
  {
    "id": "30f1f826.f06048",
    "type": "function",
    "z": "37e3d071.a4e02",
    "name": "Шторы - Открыть",
    "func": "msg.remote=\"Шторы\";\nmsg.button=\"Открыть\";\nmsg.folder=\"/home/pi/Broadlink/\";\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "x": 930,
    "y": 1140,
    "wires": [ [ "7ac8e0e7.fd804" ] ]
  }
]