Hi everbody.
I am struggelig with read/send time to my Siemens PLC.
I have made a flow, but it only work when i send a value with 2 decimals.
Example:
13:13 - works fine.
18:56 - works fine
18:01 - Not working
10:07 - Not working.
Attached is the flow. Can somebody help me what i am missing ?
[
{
"id": "4dbd5df7b5513090",
"type": "ui_numeric",
"z": "55096135d3cea7da",
"name": "",
"label": "numeric",
"tooltip": "",
"group": "42f3e01d8f47c23c",
"order": 2,
"width": 0,
"height": 0,
"wrap": false,
"passthru": true,
"topic": "topic",
"topicType": "msg",
"format": "{{value}}",
"min": 0,
"max": "23",
"step": "1",
"className": "",
"x": 740,
"y": 3340,
"wires": [
[
"c182fb6c1a79bbf1"
]
]
},
{
"id": "c378fbaaa8d71338",
"type": "function",
"z": "55096135d3cea7da",
"name": "function 44",
"func": "var asHex = parseInt(msg.payload).toString(\"16\").padStart(4, \"0\");\nvar hh = asHex.substring(0, 2);\nvar mm = asHex.substring(2, 4);\nmsg.payload = `${hh}:${mm}`\nmsg.m=mm;\nmsg.h=hh;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 310,
"y": 3400,
"wires": [
[
"e9b1640f3de0be99",
"3809542256f245ae"
]
]
},
{
"id": "c182fb6c1a79bbf1",
"type": "function",
"z": "55096135d3cea7da",
"name": "function 45",
"func": "var asDEC = parseInt(msg.payload).toString(\"2\")\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 910,
"y": 3300,
"wires": [
[
"7b582763e018e38e"
]
]
},
{
"id": "7b582763e018e38e",
"type": "debug",
"z": "55096135d3cea7da",
"name": "debug 25",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1120,
"y": 3240,
"wires": []
},
{
"id": "38142d962d4fced4",
"type": "ui_numeric",
"z": "55096135d3cea7da",
"name": "h time 3",
"label": "h:",
"tooltip": "",
"group": "045c538dbdcd8b16",
"order": 7,
"width": 2,
"height": 1,
"wrap": false,
"passthru": true,
"topic": "hh",
"topicType": "str",
"format": "{{msg.payload}}",
"min": 0,
"max": "23",
"step": 1,
"className": "",
"x": 680,
"y": 3420,
"wires": [
[
"31971ee7eeb1c7af",
"72843771666fd029"
]
]
},
{
"id": "31971ee7eeb1c7af",
"type": "debug",
"z": "55096135d3cea7da",
"name": "debug 26",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 840,
"y": 3420,
"wires": []
},
{
"id": "6dd914d78b5da41d",
"type": "inject",
"z": "55096135d3cea7da",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "4883",
"payloadType": "num",
"x": 150,
"y": 3400,
"wires": [
[
"c378fbaaa8d71338"
]
]
},
{
"id": "21c627195c60226e",
"type": "ui_numeric",
"z": "55096135d3cea7da",
"name": "m time 3",
"label": "m:",
"tooltip": "",
"group": "045c538dbdcd8b16",
"order": 8,
"width": 2,
"height": 1,
"wrap": false,
"passthru": true,
"topic": "mm",
"topicType": "str",
"format": "{{msg.payload}}",
"min": 0,
"max": "59",
"step": 1,
"className": "",
"x": 680,
"y": 3480,
"wires": [
[
"af6b261f3752907d",
"749d19fac53fcaf3"
]
]
},
{
"id": "af6b261f3752907d",
"type": "debug",
"z": "55096135d3cea7da",
"name": "debug 27",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 3520,
"wires": []
},
{
"id": "e9b1640f3de0be99",
"type": "function",
"z": "55096135d3cea7da",
"name": "function 46",
"func": "msg.payload=parseInt(msg.h);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 510,
"y": 3420,
"wires": [
[
"38142d962d4fced4",
"a76d7ec2083be8fe"
]
]
},
{
"id": "3809542256f245ae",
"type": "function",
"z": "55096135d3cea7da",
"name": "function 47",
"func": "msg.payload = parseInt(msg.m);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 510,
"y": 3460,
"wires": [
[
"21c627195c60226e",
"c49f0f546676f54b"
]
]
},
{
"id": "9883e41ad7e4817c",
"type": "function",
"z": "55096135d3cea7da",
"name": "function 48",
"func": "\nfunction revertDecimalToDecimal(h, m) {\n const combined = \"\" + h + \"\" + m;\n const originalDecimalValue = parseInt(combined, 16);\n return originalDecimalValue;\n}\n\nlet h = flow.get(\"inp3h\");\nlet m = flow.get(\"inp3m\");\n\nmsg.payload = revertDecimalToDecimal(h, m);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1150,
"y": 3440,
"wires": [
[
"f3e47ebc047caff5"
]
]
},
{
"id": "72843771666fd029",
"type": "function",
"z": "55096135d3cea7da",
"name": "function 49",
"func": "\nlet inv=msg.payload ;\nflow.set(\"inp3h\",inv);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 810,
"y": 3380,
"wires": [
[
"f8d2baaeb20a505c"
]
]
},
{
"id": "749d19fac53fcaf3",
"type": "function",
"z": "55096135d3cea7da",
"name": "function 50",
"func": "\nlet inv=msg.payload ;\nflow.set(\"inp3m\",inv);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 850,
"y": 3480,
"wires": [
[
"f8d2baaeb20a505c"
]
]
},
{
"id": "f8d2baaeb20a505c",
"type": "trigger",
"z": "55096135d3cea7da",
"name": "",
"op1": "",
"op2": "0",
"op1type": "nul",
"op2type": "str",
"duration": "1",
"extend": false,
"overrideDelay": false,
"units": "s",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 1000,
"y": 3440,
"wires": [
[
"9883e41ad7e4817c"
]
]
},
{
"id": "f3e47ebc047caff5",
"type": "debug",
"z": "55096135d3cea7da",
"name": "final out",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1300,
"y": 3420,
"wires": []
},
{
"id": "a76d7ec2083be8fe",
"type": "debug",
"z": "55096135d3cea7da",
"name": "debug 29",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "h",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 580,
"y": 3360,
"wires": []
},
{
"id": "c49f0f546676f54b",
"type": "debug",
"z": "55096135d3cea7da",
"name": "debug 30",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "m",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 600,
"y": 3540,
"wires": []
},
{
"id": "42f3e01d8f47c23c",
"type": "ui_group",
"name": "Tidsstyrring:",
"tab": "9a5c087ffc889758",
"order": 7,
"disp": true,
"width": "16",
"collapse": false,
"className": ""
},
{
"id": "045c538dbdcd8b16",
"type": "ui_group",
"name": "Group 8",
"tab": "9a5c087ffc889758",
"order": 8,
"disp": true,
"width": 6
},
{
"id": "9a5c087ffc889758",
"type": "ui_tab",
"name": "Rema 1000 Admin view",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]