Hi, I trigger a "mytimeout" node with a Thingboard dashboard and a certain timeout value. The syntax is straight forward and I get it via MQTT exaclty like it has to be.
{
"timeout": number,
}
The start mqtt message:
I managed to save the msg.payload in order to trigger the mytimeout node in dependence of other events.
The problem:
Every now and then my NodeRed server needs a reboot, which causes the variables to get lost. Via a status request to Thingsboard I get the shared attributes as a response. But Im simply not able to extract the shared attribute "timeout" and save it in the same JSON syntax as when it comes from the Dashboard itselfe, if that makes sense.
Here the request response.
And a overview about the schematic:
The first timer runs 100s.
The lower timer uses the command as a trigger, but runs the fixed default value.
Here the lower trigger flow:
[
{
"id": "acae7fb96ddba2b7",
"type": "mytimeout",
"z": "256fc4e0c15f22be",
"name": "T_on",
"outtopic": "",
"outsafe": "",
"outwarning": "Warning",
"outunsafe": "off",
"warning": "5",
"timer": "",
"debug": false,
"ndebug": false,
"ignoreCase": false,
"repeat": false,
"again": false,
"x": 1390,
"y": 500,
"wires": [
[],
[]
]
},
{
"id": "7383571347fef23c",
"type": "function",
"z": "256fc4e0c15f22be",
"name": "extract attribute timeout",
"func": "return {payload: msg.payload.shared.timeout};",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1120,
"y": 500,
"wires": [
[
"acae7fb96ddba2b7",
"30e1334bb4796bcb"
]
]
},
{
"id": "29327df981980ce6",
"type": "json",
"z": "256fc4e0c15f22be",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 730,
"y": 500,
"wires": [
[
"7383571347fef23c",
"4ee7e054d1afcd15"
]
]
}
]