At https://energy-charts.info you can find many information about the actual energy mix in Germany.
My flow gets actual data and shows a graph and a signal...
[
{
"id": "cb95544e34843c81",
"type": "http request",
"z": "2ee18b148a01d52a",
"name": "Energie-Charts",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://api.energy-charts.info/signal?country=de&postal_code=38104",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "other",
"keyValue": "unix_seconds",
"valueType": "msg",
"valueValue": "time"
},
{
"keyType": "other",
"keyValue": "share",
"valueType": "msg",
"valueValue": "anteil"
},
{
"keyType": "other",
"keyValue": "signal",
"valueType": "msg",
"valueValue": "signal"
},
{
"keyType": "other",
"keyValue": "substitute",
"valueType": "other",
"valueValue": "sub"
}
],
"x": 320,
"y": 100,
"wires": [
[
"ee4312cb3e3ad49a"
]
]
},
{
"id": "441dcc387db3aab8",
"type": "inject",
"z": "2ee18b148a01d52a",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "0 5-22 * * *",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 150,
"y": 100,
"wires": [
[
"cb95544e34843c81",
"5b82317b44553382",
"89cea6b65387baaf"
]
]
},
{
"id": "5b82317b44553382",
"type": "change",
"z": "2ee18b148a01d52a",
"name": "",
"rules": [
{
"t": "set",
"p": "timesta",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 330,
"y": 60,
"wires": [
[]
]
},
{
"id": "0822028c7c754acb",
"type": "ui_chart",
"z": "2ee18b148a01d52a",
"name": "",
"group": "c63597be5feefad7",
"order": 1,
"width": 0,
"height": 0,
"label": "Anteil regen. Energie",
"chartType": "line",
"legend": "false",
"xformat": "dd HH:mm",
"interpolate": "linear",
"nodata": "",
"dot": false,
"ymin": "",
"ymax": "",
"removeOlder": "36",
"removeOlderPoints": "",
"removeOlderUnit": "3600",
"cutout": 0,
"useOneColor": false,
"useUTC": false,
"colors": [
"#43f62f",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"outputs": 1,
"useDifferentColor": false,
"className": "",
"x": 800,
"y": 60,
"wires": [
[]
]
},
{
"id": "ee4312cb3e3ad49a",
"type": "function",
"z": "2ee18b148a01d52a",
"name": "function 45",
"func": "// Holt den aktuellen und 2h zukünftigen Ökostrom-Anteil als Ampelsignal (0..3)\n/*\n Grün / Blau: Anteil EE > Mittelwert + 10 % oder Anteil EE > 95 %\n Gelb: Mittelwert – 10 % < Anteil EE < Mittelwert + 10 %\n Rot: Anteil EE < Mittelwert – 10 %\n -1: Red (grid congestion), -violett\n 0: Red (low renewable share), \n 1: Yellow (average renewable share),\n 2: Green (high renewable share)\n*/\n\nvar time =0;\nvar signal=0 ;\nvar share=0;\nlet msg2={}, msg3={}, msg4={};//msg2: Ausgang für Status zur aktuellen Zeit, msg3: Ausgang für 2h in ZUkunft\n\nvar timestamp=flow.get(\"timesta\"); //aktuelle Zeit\nconst timestamp1h=timestamp+7200000;\n\nvar time_float = 0;\n\nvar i = 0;\nvar dataarray = [[]];\n\nfor (i = 0; i < msg.payload.unix_seconds.length; i++) {\n\n time = msg.payload.unix_seconds[i];\n time_float = time * 1000;\n share = msg.payload.share[i];\n signal = msg.payload.signal[i];\n dataarray[0][i] = { \"x\": time_float, \"y\": share };\n \n if ((time_float > timestamp) && (timestamp+901000 > time_float)) {\n msg2.payload=signal;\n msg4.payload=share;\n }\n if ((time_float > timestamp1h) && (timestamp1h + 901000 > time_float)) {\n msg3.payload = signal;\n };\n}\n\nvar chart = [{\n \"series\": [\"Ökostrom-Anteil=\"],\n \"data\": dataarray,\n \"labels\": [\"Anteil\"]\n}];\n\nmsg.payload = chart;\n\nreturn [msg,msg2,msg3,msg4];",
"outputs": 4,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 530,
"y": 100,
"wires": [
[
"0822028c7c754acb"
],
[
"01917244f7c098e6",
"d86cad2d2a910704"
],
[
"4d7ef0bd591b11e0"
],
[
"d6831a4292a29bd5",
"774243f751c6ac02"
]
]
},
{
"id": "01917244f7c098e6",
"type": "ui_led",
"z": "2ee18b148a01d52a",
"order": 4,
"group": "c63597be5feefad7",
"width": 1,
"height": 1,
"label": "",
"labelPlacement": "left",
"labelAlignment": "left",
"colorForValue": [
{
"color": "#ee27f7",
"value": "-1",
"valueType": "num"
},
{
"color": "#ff0000",
"value": "0",
"valueType": "num"
},
{
"color": "#fce94f",
"value": "1",
"valueType": "num"
},
{
"color": "#43f62f",
"value": "2",
"valueType": "num"
}
],
"allowColorForValueInMessage": false,
"shape": "circle",
"showGlow": true,
"name": "",
"x": 750,
"y": 100,
"wires": []
},
{
"id": "4d7ef0bd591b11e0",
"type": "ui_led",
"z": "2ee18b148a01d52a",
"order": 5,
"group": "c63597be5feefad7",
"width": 6,
"height": 1,
"label": "Vorhersage 2h:",
"labelPlacement": "left",
"labelAlignment": "left",
"colorForValue": [
{
"color": "#ee27f7",
"value": "-1",
"valueType": "num"
},
{
"color": "#cc0000",
"value": "0",
"valueType": "num"
},
{
"color": "#edd400",
"value": "1",
"valueType": "num"
},
{
"color": "#8ae234",
"value": "2",
"valueType": "num"
}
],
"allowColorForValueInMessage": false,
"shape": "circle",
"showGlow": false,
"name": "",
"x": 750,
"y": 140,
"wires": []
},
{
"id": "d6831a4292a29bd5",
"type": "ui_text",
"z": "2ee18b148a01d52a",
"group": "c63597be5feefad7",
"order": 2,
"width": 4,
"height": 1,
"name": "",
"label": "Strommix ",
"format": "{{msg.payload}} %",
"layout": "row-spread",
"className": "",
"style": false,
"font": "",
"fontSize": 16,
"color": "#000000",
"x": 760,
"y": 180,
"wires": []
},
{
"id": "2edea2d1a6fc8607",
"type": "ui_text",
"z": "2ee18b148a01d52a",
"group": "c63597be5feefad7",
"order": 6,
"width": 0,
"height": 0,
"name": "Aktualisierung",
"label": "<font size=1>Aktualisiert: ",
"format": "<font size=1>{{msg.payload}}",
"layout": "row-left",
"className": "",
"style": false,
"font": "",
"fontSize": "",
"color": "#000000",
"x": 360,
"y": 160,
"wires": []
},
{
"id": "89cea6b65387baaf",
"type": "moment",
"z": "2ee18b148a01d52a",
"name": "Timestamp",
"topic": "",
"input": "payload",
"inputType": "msg",
"inTz": "Europe/Berlin",
"adjAmount": 0,
"adjType": "days",
"adjDir": "add",
"format": "dddd, D.MM.YY HH:mm",
"locale": "de",
"output": "payload",
"outputType": "msg",
"outTz": "Europe/Berlin",
"x": 190,
"y": 160,
"wires": [
[
"2edea2d1a6fc8607"
]
]
},
{
"id": "d86cad2d2a910704",
"type": "ui_led",
"z": "2ee18b148a01d52a",
"order": 7,
"group": "66afbcec5bd7c7bb",
"width": 1,
"height": 1,
"label": "",
"labelPlacement": "left",
"labelAlignment": "left",
"colorForValue": [
{
"color": "#ee27f7",
"value": "-1",
"valueType": "num"
},
{
"color": "#ff0000",
"value": "0",
"valueType": "num"
},
{
"color": "#fce94f",
"value": "1",
"valueType": "num"
},
{
"color": "#43f62f",
"value": "2",
"valueType": "num"
}
],
"allowColorForValueInMessage": false,
"shape": "circle",
"showGlow": true,
"name": "Ă–ko",
"x": 870,
"y": 100,
"wires": []
},
{
"id": "774243f751c6ac02",
"type": "ui_text",
"z": "2ee18b148a01d52a",
"group": "66afbcec5bd7c7bb",
"order": 14,
"width": 4,
"height": 1,
"name": "",
"label": "Strommix ",
"format": "<font size=4>{{msg.payload| number:0}} %",
"layout": "row-spread",
"className": "",
"style": false,
"font": "",
"fontSize": 16,
"color": "#000000",
"x": 760,
"y": 220,
"wires": []
},
{
"id": "c63597be5feefad7",
"type": "ui_group",
"name": "Ă–kostrom-Anteil",
"tab": "6b520bda.e997a4",
"order": 2,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "66afbcec5bd7c7bb",
"type": "ui_group",
"name": "Einstellungen",
"tab": "2acb95821445c8af",
"order": 3,
"disp": false,
"width": "5",
"collapse": false,
"className": ""
},
{
"id": "6b520bda.e997a4",
"type": "ui_tab",
"name": "System",
"icon": "dashboard",
"order": 7,
"disabled": false,
"hidden": false
},
{
"id": "2acb95821445c8af",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]