Skip to content

Instantly share code, notes, and snippets.

@dcbo
Created January 31, 2023 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcbo/fae3049bb12b6104ec7d7ce83075a181 to your computer and use it in GitHub Desktop.
Save dcbo/fae3049bb12b6104ec7d7ce83075a181 to your computer and use it in GitHub Desktop.
unset property overwrites text node
[
{
"id": "95b5b1dca3a6b5f6",
"type": "inject",
"z": "e4fd59d6388ce474",
"name": "both",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "both",
"payload": "",
"payloadType": "date",
"x": 290,
"y": 280,
"wires": [
[
"935c46bee3d83810"
]
]
},
{
"id": "935c46bee3d83810",
"type": "function",
"z": "e4fd59d6388ce474",
"name": "Set Two Properties",
"func": "var myMsg = {};\nmyMsg.payload = {};\nmyMsg.topic = msg.topic;\n\nif ((msg.topic == \"both\") || (msg.topic == \"first\")) {\n myMsg.payload.first = msg.payload;\n}\n\nif ((msg.topic == \"both\") || (msg.topic == \"second\")) {\n myMsg.payload.second = msg.payload;\n}\n\nreturn myMsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 220,
"wires": [
[
"4cbe53432e434550",
"2d873a5f37ee7060",
"e3d03199a3da2725"
]
]
},
{
"id": "4cbe53432e434550",
"type": "debug",
"z": "e4fd59d6388ce474",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 720,
"y": 280,
"wires": []
},
{
"id": "9f225f850a0f5355",
"type": "inject",
"z": "e4fd59d6388ce474",
"name": "first",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "first",
"payload": "",
"payloadType": "date",
"x": 290,
"y": 180,
"wires": [
[
"935c46bee3d83810"
]
]
},
{
"id": "c243adf09777690e",
"type": "inject",
"z": "e4fd59d6388ce474",
"name": "second",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "second",
"payload": "",
"payloadType": "date",
"x": 290,
"y": 220,
"wires": [
[
"935c46bee3d83810"
]
]
},
{
"id": "2d873a5f37ee7060",
"type": "ui_text",
"z": "e4fd59d6388ce474",
"group": "b7d12b8d.651c8",
"order": 1,
"width": 0,
"height": 0,
"name": "first",
"label": "first",
"format": "{{msg.payload.first}}",
"layout": "row-spread",
"className": "",
"x": 710,
"y": 180,
"wires": []
},
{
"id": "e3d03199a3da2725",
"type": "ui_text",
"z": "e4fd59d6388ce474",
"group": "b7d12b8d.651c8",
"order": 1,
"width": 0,
"height": 0,
"name": "second",
"label": "second",
"format": "{{msg.payload.second}}",
"layout": "row-spread",
"className": "",
"x": 720,
"y": 220,
"wires": []
},
{
"id": "b7d12b8d.651c8",
"type": "ui_group",
"name": "Default",
"tab": "fe5d396a.0d6d4",
"order": 1,
"disp": true,
"width": "20",
"collapse": false
},
{
"id": "fe5d396a.0d6d4",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment