Skip to content

Instantly share code, notes, and snippets.

@yeffrimic
Created October 19, 2019 06:42
Show Gist options
  • Save yeffrimic/f7b49a76226ace1aeb7aa17bd1b322e5 to your computer and use it in GitHub Desktop.
Save yeffrimic/f7b49a76226ace1aeb7aa17bd1b322e5 to your computer and use it in GitHub Desktop.
[
{
"id": "443a255c.e61854",
"type": "tab",
"label": "Flow 3",
"disabled": false,
"info": ""
},
{
"id": "f3a59ec7.9dc1d",
"type": "mqtt in",
"z": "443a255c.e61854",
"name": "",
"topic": "/firebase/chat",
"qos": "2",
"datatype": "auto",
"broker": "105449be.4e2026",
"x": 150,
"y": 180,
"wires": [
[
"fa53a2d5.dc9ae8",
"cb478c77.cbfc78"
]
]
},
{
"id": "fa53a2d5.dc9ae8",
"type": "debug",
"z": "443a255c.e61854",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 390,
"y": 180,
"wires": []
},
{
"id": "e67aaff0.7ee61",
"type": "ui_button",
"z": "443a255c.e61854",
"name": "",
"group": "81663b62.2c0d78",
"order": 3,
"width": 0,
"height": 0,
"passthru": false,
"label": "Enviar",
"tooltip": "",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "",
"payloadType": "str",
"topic": "enviar",
"x": 150,
"y": 360,
"wires": [
[
"eaeaeec4.a93ef"
]
]
},
{
"id": "6eb22506.c2f444",
"type": "ui_text_input",
"z": "443a255c.e61854",
"name": "",
"label": "chat id",
"tooltip": "",
"group": "81663b62.2c0d78",
"order": 1,
"width": 0,
"height": 0,
"passthru": true,
"mode": "text",
"delay": "1",
"topic": "idchat",
"x": 152.85721479143413,
"y": 274.7618756975446,
"wires": [
[
"eaeaeec4.a93ef"
]
]
},
{
"id": "571747c3.ae9248",
"type": "ui_text_input",
"z": "443a255c.e61854",
"name": "",
"label": "mensaje",
"tooltip": "",
"group": "81663b62.2c0d78",
"order": 2,
"width": 0,
"height": 0,
"passthru": true,
"mode": "text",
"delay": "1",
"topic": "mensaje",
"x": 161.42864990234375,
"y": 319.0475769042969,
"wires": [
[
"eaeaeec4.a93ef"
]
]
},
{
"id": "eaeaeec4.a93ef",
"type": "function",
"z": "443a255c.e61854",
"name": "",
"func": "context.msg = context.msg || {};\n\nswitch (msg.topic){\n case 'mensaje':\n context.msg.payload ={\n mensaje :msg.payload,\n remitente: \"yeffri\",\n timestamp: new Date()\n };\n break;\n case 'idchat':\n context.msg.topic = msg.payload;\n break;\n case 'enviar':\n if(context.msg.topic){\n return context.msg;\n }\n}",
"outputs": 1,
"noerr": 0,
"x": 348.8096160888672,
"y": 315.35723876953125,
"wires": [
[
"25cda91f.e1d9d6",
"d0af3b9.6b084c8"
]
]
},
{
"id": "25cda91f.e1d9d6",
"type": "debug",
"z": "443a255c.e61854",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 492.57151794433594,
"y": 268.1349182128906,
"wires": []
},
{
"id": "d0af3b9.6b084c8",
"type": "mqtt out",
"z": "443a255c.e61854",
"name": "",
"topic": "",
"qos": "",
"retain": "",
"broker": "105449be.4e2026",
"x": 488.9048614501953,
"y": 341.3570861816406,
"wires": []
},
{
"id": "33f76e34.ab69aa",
"type": "ui_text",
"z": "443a255c.e61854",
"group": "336c9b3f.0a6b8c",
"order": 0,
"width": 0,
"height": 0,
"name": "",
"label": "remitente",
"format": "{{msg.payload.remitente}}",
"layout": "row-spread",
"x": 540,
"y": 60,
"wires": []
},
{
"id": "57ca6d38.150214",
"type": "ui_text",
"z": "443a255c.e61854",
"group": "336c9b3f.0a6b8c",
"order": 3,
"width": 0,
"height": 0,
"name": "",
"label": "Mensaje",
"format": "{{msg.payload.mensaje}}",
"layout": "col-center",
"x": 540,
"y": 120,
"wires": []
},
{
"id": "cb478c77.cbfc78",
"type": "json",
"z": "443a255c.e61854",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 375.0000305175781,
"y": 91,
"wires": [
[
"33f76e34.ab69aa",
"57ca6d38.150214"
]
]
},
{
"id": "f8c83ca4.ff315",
"type": "debug",
"z": "443a255c.e61854",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 428.5185852050781,
"y": 1068.148193359375,
"wires": []
},
{
"id": "92ee841a.95a958",
"type": "http request",
"z": "443a255c.e61854",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": false,
"url": "https://taller-iot-10067.firebaseio.com/firebase/chat.json",
"tls": "",
"proxy": "",
"authType": "",
"x": 389.6295471191406,
"y": 973.3333740234375,
"wires": [
[
"aad21b52.41b54"
]
]
},
{
"id": "51c8567.031e8a8",
"type": "inject",
"z": "443a255c.e61854",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 327.77777777777777,
"y": 887.7777777777777,
"wires": [
[
"92ee841a.95a958"
]
]
},
{
"id": "aad21b52.41b54",
"type": "json",
"z": "443a255c.e61854",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 376.6666836208767,
"y": 1021.1111111111111,
"wires": [
[
"f8c83ca4.ff315"
]
]
},
{
"id": "105449be.4e2026",
"type": "mqtt-broker",
"z": "",
"name": "broker.mqttdashboard.com",
"broker": "broker.mqttdashboard.com",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "81663b62.2c0d78",
"type": "ui_group",
"z": "",
"name": "Mensajes recibidos",
"tab": "5a75793d.02d7a8",
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "336c9b3f.0a6b8c",
"type": "ui_group",
"z": "",
"name": "mensaje recibido",
"tab": "5a75793d.02d7a8",
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "5a75793d.02d7a8",
"type": "ui_tab",
"z": "",
"name": "chat",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment