Thank you! I just solved it like this:
[
{
"id": "1fb0dec6ddaa11c1",
"type": "inject",
"z": "1b12c10.509463f",
"name": "timer 10 sec / set value to 0",
"props": [
{
"p": "payload"
}
],
"repeat": "2",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 180,
"y": 440,
"wires": [
[
"bcbcb32a35d54d5d"
]
]
},
{
"id": "e331649be74fcc42",
"type": "switch",
"z": "1b12c10.509463f",
"name": "value <= 0",
"property": "value",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "0",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 630,
"y": 380,
"wires": [
[
"f19dfab3736ae2c8"
]
]
},
{
"id": "bf9305738917358e",
"type": "switch",
"z": "1b12c10.509463f",
"name": "value > 0",
"property": "value",
"propertyType": "msg",
"rules": [
{
"t": "gt",
"v": "0",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 520,
"y": 620,
"wires": [
[
"b29850a155842ee1"
]
]
},
{
"id": "fa4116889a32f8cf",
"type": "debug",
"z": "1b12c10.509463f",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "value",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1080,
"y": 380,
"wires": []
},
{
"id": "bcbcb32a35d54d5d",
"type": "function",
"z": "1b12c10.509463f",
"name": "get value",
"func": "msg.value = flow.get(\"test\",\"store\");\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 420,
"y": 440,
"wires": [
[
"e331649be74fcc42",
"bf9305738917358e"
]
]
},
{
"id": "f19dfab3736ae2c8",
"type": "function",
"z": "1b12c10.509463f",
"name": "set value to 5",
"func": "flow.set(\"test\", msg.value = 5, \"store\");\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 810,
"y": 380,
"wires": [
[
"fa4116889a32f8cf"
]
]
},
{
"id": "b29850a155842ee1",
"type": "function",
"z": "1b12c10.509463f",
"name": "-1",
"func": "flow.set(\"test\", msg.value = msg.value - 1, \"store\");\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 770,
"y": 540,
"wires": [
[
"fa4116889a32f8cf"
]
]
}
]