Hi!
I THINK I was able to achieve some of the required functionality:
[
{
"id": "e796441096cb2290",
"type": "http request",
"z": "962f7cc1f3b91a29",
"name": "",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "http://192.168.0.45:5000/action/dayahead-optim",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "other",
"keyValue": "prod_price_forecast",
"valueType": "msg",
"valueValue": "prod_price_forecast"
},
{
"keyType": "other",
"keyValue": "pv_power_forecast",
"valueType": "msg",
"valueValue": "pv_power_forecast"
},
{
"keyType": "other",
"keyValue": "prediction_horizon",
"valueType": "msg",
"valueValue": "msg.payload.prod_price_forecast.length"
},
{
"keyType": "other",
"keyValue": "debug",
"valueType": "other",
"valueValue": "true"
}
],
"x": 1330,
"y": 1320,
"wires": [
[
"66da5f2244cadff9"
]
]
},
{
"id": "82dd6511ebfe4faf",
"type": "http request",
"z": "962f7cc1f3b91a29",
"name": "EPEX Spot Preise von aWATTar abfragen",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://api.awattar.at/v1/marketdata",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 620,
"y": 1220,
"wires": [
[
"9ffb9ea738887dfc"
]
]
},
{
"id": "f486e90555a65b5f",
"type": "inject",
"z": "962f7cc1f3b91a29",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 340,
"y": 1220,
"wires": [
[
"82dd6511ebfe4faf"
]
]
},
{
"id": "66da5f2244cadff9",
"type": "debug",
"z": "962f7cc1f3b91a29",
"name": "debug 11",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1360,
"y": 1440,
"wires": []
},
{
"id": "13dde51211cac169",
"type": "change",
"z": "962f7cc1f3b91a29",
"name": "",
"rules": [
{
"t": "set",
"p": "prod_price_forecast",
"pt": "msg",
"to": "payload.prod_price_forecast",
"tot": "msg",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 940,
"y": 1280,
"wires": [
[
"d4b03fa3f6121306"
]
]
},
{
"id": "9ffb9ea738887dfc",
"type": "function",
"z": "962f7cc1f3b91a29",
"name": "generate pord_price_forecast array",
"func": "const msg2 = { payload: { prod_price_forecast: [] }}\nmsg.payload.data.forEach(entry => {\n msg2.payload.prod_price_forecast.push((entry.marketprice / 1000 - 0.0048) * 1.2)\n msg2.payload.prod_price_forecast.push((entry.marketprice / 1000 - 0.0048) * 1.2)\n})\n//const msg3 = JSON.stringify(msg2);\n\n//return msg3;\nreturn msg2;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 380,
"y": 1280,
"wires": [
[
"45cf8107bdf0ed6d"
]
]
},
{
"id": "d4b03fa3f6121306",
"type": "api-current-state",
"z": "962f7cc1f3b91a29",
"name": "",
"server": "aadbde09.d5ab3",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "sensor.pv_forecast_upcoming",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": "0",
"forType": "num",
"forUnits": "minutes",
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 710,
"y": 1360,
"wires": [
[
"a80e9426f9163929"
]
]
},
{
"id": "da0435c4b3165ef8",
"type": "inject",
"z": "962f7cc1f3b91a29",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "array_length",
"v": "10",
"vt": "num"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 440,
"y": 1360,
"wires": [
[
"d4b03fa3f6121306"
]
]
},
{
"id": "a80e9426f9163929",
"type": "change",
"z": "962f7cc1f3b91a29",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "data.attributes.kwh",
"tot": "msg",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1020,
"y": 1360,
"wires": [
[
"a50b41b17e5d7477"
]
]
},
{
"id": "a50b41b17e5d7477",
"type": "function",
"z": "962f7cc1f3b91a29",
"name": "function 2",
"func": "const array = msg.payload;\nconst array_length = msg.array_length\nvar array_part = array.slice(0, array_length);\nvar array_part_multiplied = array_part.map(function(element) {\n return element * 1000;\n});\n\nmsg.array_part_multiplied = array_part_multiplied.flatMap(i => [i, i]);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 820,
"y": 1440,
"wires": [
[
"df527422f28f7622"
]
]
},
{
"id": "45cf8107bdf0ed6d",
"type": "function",
"z": "962f7cc1f3b91a29",
"name": "get prediction horizon",
"func": "const array_length = msg.payload.prod_price_forecast.length / 2;\n\nmsg.array_length = array_length;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 680,
"y": 1280,
"wires": [
[
"13dde51211cac169"
]
]
},
{
"id": "df527422f28f7622",
"type": "change",
"z": "962f7cc1f3b91a29",
"name": "",
"rules": [
{
"t": "set",
"p": "pv_power_forecast",
"pt": "msg",
"to": "array_part_multiplied",
"tot": "msg",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1040,
"y": 1440,
"wires": [
[
"e796441096cb2290"
]
]
},
{
"id": "aadbde09.d5ab3",
"type": "server",
"name": "Home Assistant",
"version": 5,
"addon": false,
"rejectUnauthorizedCerts": false,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": false,
"heartbeatInterval": "30",
"areaSelector": "friendlyName",
"deviceSelector": "friendlyName",
"entitySelector": "friendlyName",
"statusSeparator": "at: ",
"statusYear": "hidden",
"statusMonth": "short",
"statusDay": "numeric",
"statusHourCycle": "h23",
"statusTimeFormat": "h:m",
"enableGlobalContextStore": true
}
]
But unfortunately I can not see/debug the request from the http node at the end.
HTTP logger node also does not show anything here.
Do you have an idea how I could do so?
Thanks