Laadpaal-to-Nodred

This commit is contained in:
2026-01-05 21:04:04 +01:00
parent a9813324bd
commit 63a5fcc29d

336
Laadpaal-to-Nodred Normal file
View File

@@ -0,0 +1,336 @@
[
{
"id": "2346f5f39f7c93c5",
"type": "tab",
"label": "API",
"disabled": false,
"info": "",
"env": []
},
{
"id": "inject_test",
"type": "inject",
"z": "2346f5f39f7c93c5",
"name": "Test POST",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 100,
"y": 80,
"wires": [
[
"build_payload"
]
]
},
{
"id": "build_payload",
"type": "function",
"z": "2346f5f39f7c93c5",
"name": "Maak Vattenfall JSON payload",
"func": "msg.headers = {\n \"Content-Type\": \"application/json\"\n};\n\nmsg.payload = [\n {\n \"lat\": 51.6973345,\n \"lng\": 5.2033599\n }\n];\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 410,
"y": 40,
"wires": [
[
"http_post"
]
]
},
{
"id": "http_post",
"type": "http request",
"z": "2346f5f39f7c93c5",
"name": "POST → Vattenfall Stations API",
"method": "POST",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://incharge.vattenfall.nl/api/v1/map/Stations/",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 730,
"y": 40,
"wires": [
[
"7f79dd52622a0c70"
]
]
},
{
"id": "7f79dd52622a0c70",
"type": "function",
"z": "2346f5f39f7c93c5",
"name": "function 3",
"func": "const station = msg.payload[0];\n\n// maxPower omrekenen van Watt → kW\nconst maxPowerKW = station.maxPower / 1000;\n\n// Output 1 → street\nlet out1 = {\n payload: station.street\n};\n\n// Output 2 → city\nlet out2 = {\n payload: station.city\n};\n\n// Output 3 → alleen availableCount\nlet out3 = {\n payload: station.connectorsData.connectors[0].availableCount\n};\n\n// Output 4 → maxPower in kW\nlet out4 = {\n payload: maxPowerKW\n};\n\n// 4 outputs teruggeven\nreturn [out1, out2, out3, out4];\n",
"outputs": 4,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 960,
"y": 40,
"wires": [
[
"5ef01d5db67a22ef"
],
[
"5dcd21abf541a293"
],
[
"0b176587affc5543",
"b538840faa7dbd16"
],
[
"de7328834d304b0c"
]
]
},
{
"id": "5ef01d5db67a22ef",
"type": "debug",
"z": "2346f5f39f7c93c5",
"name": "Straatnaam",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1230,
"y": 20,
"wires": []
},
{
"id": "5dcd21abf541a293",
"type": "debug",
"z": "2346f5f39f7c93c5",
"name": "Locatie",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1220,
"y": 60,
"wires": []
},
{
"id": "0b176587affc5543",
"type": "debug",
"z": "2346f5f39f7c93c5",
"name": "aantal sockets",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1240,
"y": 100,
"wires": []
},
{
"id": "de7328834d304b0c",
"type": "debug",
"z": "2346f5f39f7c93c5",
"name": "KWH",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1210,
"y": 140,
"wires": []
},
{
"id": "12c67a03c9848f4c",
"type": "inject",
"z": "2346f5f39f7c93c5",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "10",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 110,
"y": 40,
"wires": [
[
"build_payload"
]
]
},
{
"id": "b538840faa7dbd16",
"type": "ha-sensor",
"z": "2346f5f39f7c93c5",
"name": "Lisdodde",
"entityConfig": "2261683fbf87b287",
"version": 0,
"state": "payload",
"stateType": "msg",
"attributes": [],
"inputOverride": "allow",
"outputProperties": [],
"x": 1220,
"y": 180,
"wires": [
[]
]
},
{
"id": "f36fbf112eb85236",
"type": "inject",
"z": "2346f5f39f7c93c5",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"v": "1",
"vt": "num"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "2",
"payloadType": "num",
"x": 1050,
"y": 180,
"wires": [
[
"b538840faa7dbd16"
]
]
},
{
"id": "2261683fbf87b287",
"type": "ha-entity-config",
"server": "8c797fff6dc8e6ce",
"deviceConfig": "2c1736108b968d14",
"name": "Lisdodde charger",
"version": 6,
"entityType": "sensor",
"haConfig": [
{
"property": "name",
"value": "Lisdodde charger"
},
{
"property": "icon",
"value": "mdi:ev-plug-type2"
},
{
"property": "entity_picture",
"value": ""
},
{
"property": "entity_category",
"value": ""
},
{
"property": "device_class",
"value": ""
},
{
"property": "unit_of_measurement",
"value": "sockets"
},
{
"property": "state_class",
"value": ""
}
],
"resend": false,
"debugEnabled": false
},
{
"id": "8c797fff6dc8e6ce",
"type": "server",
"name": "Home Assistant",
"version": 6,
"addon": false,
"rejectUnauthorizedCerts": false,
"ha_boolean": [
"y",
"yes",
"true",
"on",
"home",
"open"
],
"connectionDelay": true,
"cacheJson": true,
"heartbeat": true,
"heartbeatInterval": 30,
"areaSelector": "friendlyName",
"deviceSelector": "friendlyName",
"entitySelector": "friendlyName",
"statusSeparator": ": ",
"statusYear": "hidden",
"statusMonth": "short",
"statusDay": "numeric",
"statusHourCycle": "default",
"statusTimeFormat": "h:m",
"enableGlobalContextStore": false
},
{
"id": "2c1736108b968d14",
"type": "ha-device-config",
"name": "Lisdodde charger",
"hwVersion": "v.0.1",
"manufacturer": "M",
"model": "Charger",
"swVersion": "v1.1"
},
{
"id": "ca8ecbbf4028a028",
"type": "global-config",
"env": [],
"modules": {
"node-red-contrib-home-assistant-websocket": "0.80.3"
}
}
]