[
{
"id": "f88dc0dd72cd0a25",
"type": "inject",
"z": "dabdc8fc290e3b36",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 300,
"wires": [
[
"32132abba67ed588"
]
]
},
{
"id": "32132abba67ed588",
"type": "http request",
"z": "dabdc8fc290e3b36",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://www.holzpellets.net/pelletspreise/",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 370,
"y": 300,
"wires": [
[
"7c04d5770e17ef16",
"f266365a77668506"
]
]
},
{
"id": "7c04d5770e17ef16",
"type": "html",
"z": "dabdc8fc290e3b36",
"name": "",
"property": "payload",
"outproperty": "payload",
"tag": "p",
"ret": "html",
"as": "single",
"x": 550,
"y": 300,
"wires": [
[
"0fc5234932db8552"
]
]
},
{
"id": "0fc5234932db8552",
"type": "function",
"z": "dabdc8fc290e3b36",
"name": "function 5",
"func": "var EuroPos=0;\nvar DatumPos=0\nvar count=0;\n\n// find Pragraph containing Euro Price\n\nfor (var i = 0; i < 30; i++) {\n if (msg.payload[i].includes(\"Bundesweite Holzpelletspreise\")) {\n break;\n }\n else\n { count++;}\n}\n\nEuroPos = count+1;\nDatumPos= count+2;\n\n// var EuroPos = 18;\n// var DatumPos = 19\n\nvar words = msg.payload[EuroPos].split(' ');\nvar Preis = (words[0]) + \" Euro\";\n\nwords = msg.payload[DatumPos].split(',');\nvar Datum = words[0];\n\nvar Zeit = words[1];\nwords = Zeit.split(' ');\nZeit = words[1] + \":00\";\n\nvar pattern = /(\\d{2})\\.(\\d{2})\\.(\\d{4})/;\nvar dt = Datum.replace(pattern, '$3-$2-$1') + \" \" + Zeit;\n// var dt = new Date(Datum.replace(pattern, '$3-$2-$1') + Zeit );\ndt = new Date(dt);\n\nnode.status({\n fill: \"green\",\n shape: \"ring\",\n text: \"Preis: \" + Preis +\n \", Datum: \" + Datum +\n \", Zeit: \" + Zeit +\n \", Count: \" + count\n});\n\n\nreturn [{payload:Preis}, {payload:dt}];",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 720,
"y": 300,
"wires": [
[
"e5cbb3eee7041f2b"
],
[
"8ddc1085d9f840e4"
]
]
},
{
"id": "e5cbb3eee7041f2b",
"type": "debug",
"z": "dabdc8fc290e3b36",
"name": "debug 10",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 940,
"y": 220,
"wires": []
},
{
"id": "8ddc1085d9f840e4",
"type": "debug",
"z": "dabdc8fc290e3b36",
"name": "debug 12",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 940,
"y": 280,
"wires": []
}
]
Comments