[
{
"id": "6413a75bc26624d5",
"type": "tab",
"label": "Flow 3",
"disabled": false,
"info": "",
"env": []
},
{
"id": "6f4019ff5839f3ce",
"type": "http response",
"z": "6413a75bc26624d5",
"name": "",
"statusCode": "",
"headers": {},
"x": 670,
"y": 160,
"wires": []
},
{
"id": "5a450b35838cf1c0",
"type": "http in",
"z": "6413a75bc26624d5",
"name": "",
"url": "/time-form",
"method": "post",
"upload": false,
"swaggerDoc": "",
"x": 380,
"y": 220,
"wires": [
[
"6f4019ff5839f3ce",
"8e6f24219e6d5628"
]
]
},
{
"id": "7c8013576233982a",
"type": "ui_template",
"z": "6413a75bc26624d5",
"group": "2005ea10b222ccc9",
"name": "Mon-to-Fri_On-Timer",
"order": 3,
"width": 0,
"height": 0,
"format": "<html>\n\n<head>\n <title>Time Form</title>\n <script src=\"https://code.jquery.com/jquery-3.6.0.min.js\"></script>\n <script>\n $(function() {\n $('form').submit(function(event) {\n event.preventDefault();\n $.ajax({\n url: '/time-form',\n type: 'POST',\n data: $('form').serialize(),\n success: function(result) {\n $('#result').text(result);\n }\n });\n });\n });\n </script>\n\n</head>\n\n<body>\n <h1>Enter a Time Value</h1>\n <form>\n <label for=\"time-input\">Time:</label>\n <input type=\"time\" id=\"time\" name=\"time\" value=\"{{payload.time}}\">\n <button type=\"submit\">Submit</button>\n </form>\n <div id=\"result\"></div>\n</body>\n\n\n\n</html>",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
"x": 460,
"y": 160,
"wires": [
[
"6f4019ff5839f3ce"
]
]
},
{
"id": "ea45db27910ba680",
"type": "function",
"z": "6413a75bc26624d5",
"name": "function 51",
"func": "// Convert hexadecimal string to decimal number\nvar in_value = msg.payload;\n//var ura = in_value * 100\nvar ura = in_value * 1\nvar hex = msg.payload\nvar decimal = parseInt(ura, 16);\n\n// Create new message with decimal number\nmsg.payload = decimal;\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 730,
"y": 220,
"wires": [
[
"74b534acf8298ce0"
]
]
},
{
"id": "8e6f24219e6d5628",
"type": "function",
"z": "6413a75bc26624d5",
"name": "function 52",
"func": "var timeValue = msg.payload.time;\n\n// Check that the time value is not empty\nif (!timeValue) {\n msg.payload = \"Error: Time value is empty\";\n return msg;\n}\n\nvar timeParts = timeValue.split(\":\");\nvar hours = parseInt(timeParts[0]);\nvar minutes = parseInt(timeParts[1]);\n\n//var decimalValue = hours + minutes / 60;\nvar decimalValue = hours *100 + minutes ;\nmsg.payload = decimalValue;\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 570,
"y": 220,
"wires": [
[
"ea45db27910ba680"
]
]
},
{
"id": "1ced31a1d5dcee6a",
"type": "comment",
"z": "6413a75bc26624d5",
"name": "nedelujoč form za time",
"info": "",
"x": 580,
"y": 120,
"wires": []
},
{
"id": "6b0f3fa0b1cd2f44",
"type": "http in",
"z": "6413a75bc26624d5",
"name": "",
"url": "/time-form",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 240,
"y": 160,
"wires": [
[
"7c8013576233982a"
]
]
},
{
"id": "74b534acf8298ce0",
"type": "debug",
"z": "6413a75bc26624d5",
"name": "debug 21",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 900,
"y": 220,
"wires": []
},
{
"id": "2005ea10b222ccc9",
"type": "ui_group",
"name": "test",
"tab": "e2e04d88d4584015",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "e2e04d88d4584015",
"type": "ui_tab",
"name": "test timer",
"icon": "dashboard",
"order": 9,
"disabled": false,
"hidden": false
}
]
In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```
)
```
code goes here
```
You can edit and correct your post by clicking the pencil icon.
See this post for more details - How to share code or flow json
You will also want to share some more details about what you are trying to achieve and what you've tried so far.
Take a look at the cookbook entry Create an HTTP Endpoint and see where you can go from there.
Also please explain what you are trying to do.
I fixed your code but in order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```
)
```
code goes here
```
See this post for more details - How to share code or flow json
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.