Skip to content

Instantly share code, notes, and snippets.

@rodrigovilar
Created August 30, 2025 20:48
Show Gist options
  • Save rodrigovilar/94875ba6f6d7ac04699fdf55ce6383d4 to your computer and use it in GitHub Desktop.
Save rodrigovilar/94875ba6f6d7ac04699fdf55ce6383d4 to your computer and use it in GitHub Desktop.
Node-RED exemplo
[
{
"id": "sensor-simulador",
"type": "tab",
"label": "Simulador Sensores"
},
{
"id": "inject-temp",
"type": "inject",
"z": "sensor-simulador",
"name": "Temp",
"props": [
{
"p": "payload"
}
],
"repeat": "5",
"payload": "",
"payloadType": "date",
"x": 100,
"y": 60,
"wires": [
[
"gera-temp"
]
]
},
{
"id": "gera-temp",
"type": "function",
"z": "sensor-simulador",
"name": "Gerar Temperatura",
"func": "msg.payload = {\n sensor: 'temperatura',\n valor: Math.random() * 20 + 20,\n ts: new Date().toISOString()\n}; \nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 280,
"y": 60,
"wires": [
[
"envia-webhook"
]
]
},
{
"id": "envia-webhook",
"type": "http request",
"z": "sensor-simulador",
"name": "Enviar para n8n",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "http://n8n:5678/webhook-test/sensores",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 480,
"y": 60,
"wires": [
[
"0d4d494b2fa89d32"
]
]
},
{
"id": "0d4d494b2fa89d32",
"type": "debug",
"z": "sensor-simulador",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 640,
"y": 140,
"wires": []
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment