Hi, I´m struggeling with a syntax problem:
I only want to add a prefix to a number und convert it into a JSON in order to send it as "key": value to Thingsboard.
Message: {"attribute1":"value1"}
This flow shows my problem: the JSON inject works, but the second doesn´t.
What am I missing in the example below?
[
{
"id": "1afcdbc96ee82a20",
"type": "debug",
"z": "d6aef09d.37155",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1450,
"y": 3440,
"wires": []
},
{
"id": "5a47a129618af689",
"type": "function",
"z": "d6aef09d.37155",
"name": "add prefix inputStatus8_1",
"func": "msg.payload = \"inputStatus8_1: \" + msg.payload;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1070,
"y": 3480,
"wires": [
[
"a9b8ea3e197d138b",
"04479bce7a7fbece"
]
]
},
{
"id": "bf383bae0f832117",
"type": "trigger",
"z": "d6aef09d.37155",
"name": "{\"inputStatus8_1\":0}",
"op1": "{\"inputStatus8_1\":0}",
"op2": "",
"op1type": "json",
"op2type": "nul",
"duration": "250",
"extend": false,
"overrideDelay": false,
"units": "ms",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 1050,
"y": 3280,
"wires": [
[
"14c03378b1f86cc5"
]
]
},
{
"id": "9ea57338ffa0c977",
"type": "inject",
"z": "d6aef09d.37155",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "true",
"payloadType": "bool",
"x": 850,
"y": 3280,
"wires": [
[
"bf383bae0f832117"
]
]
},
{
"id": "14c03378b1f86cc5",
"type": "debug",
"z": "d6aef09d.37155",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1310,
"y": 3220,
"wires": []
},
{
"id": "04479bce7a7fbece",
"type": "debug",
"z": "d6aef09d.37155",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1310,
"y": 3400,
"wires": []
},
{
"id": "a9b8ea3e197d138b",
"type": "json",
"z": "d6aef09d.37155",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 1270,
"y": 3480,
"wires": [
[
"1afcdbc96ee82a20"
]
]
},
{
"id": "9058b1d4540c74c4",
"type": "inject",
"z": "d6aef09d.37155",
"name": "var number",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 860,
"y": 3480,
"wires": [
[
"5a47a129618af689"
]
]
}
]