Dieser Flow ruft die Preise der kommenden 24 Stunden von der aWATTar-API ab und stellt sie grafisch in einem Balkendiagramm dar. Außerdem stellt er sie in einem Array zur weiteren Verarbeitung zur Verfügung.
-
-
Save JLorenz86/df892f62326e5dce5708b7512213ce24 to your computer and use it in GitHub Desktop.
Preise von aWATTar abfragen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"a64b091a.a1bf2","type":"tab","label":"aWATTar","disabled":false,"info":""},{"id":"8b5f6c04.3b618","type":"http request","z":"a64b091a.a1bf2","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://api.awattar.de/v1/marketdata","tls":"","persist":false,"proxy":"","authType":"","x":330,"y":340,"wires":[["192872f5.e2d8fd"]]},{"id":"d14916ff.24eb98","type":"inject","z":"a64b091a.a1bf2","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":340,"wires":[["8b5f6c04.3b618"]]},{"id":"b55ac867.5e8d18","type":"debug","z":"a64b091a.a1bf2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":400,"wires":[]},{"id":"192872f5.e2d8fd","type":"json","z":"a64b091a.a1bf2","name":"","property":"payload","action":"","pretty":false,"x":490,"y":340,"wires":[["c45ef36c.746fb"]]},{"id":"c45ef36c.746fb","type":"split","z":"a64b091a.a1bf2","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":120,"y":400,"wires":[["4df30205.32ac34","e155a845.29cf58"]]},{"id":"4df30205.32ac34","type":"split","z":"a64b091a.a1bf2","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":340,"y":400,"wires":[["e43d0284.cb377"]]},{"id":"e43d0284.cb377","type":"switch","z":"a64b091a.a1bf2","name":"","property":"payload","propertyType":"msg","rules":[{"t":"istype","v":"object","vt":"object"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":400,"wires":[["b55ac867.5e8d18"]]},{"id":"673642ac.a881a4","type":"comment","z":"a64b091a.a1bf2","name":"aWATTar abfragen","info":"","x":450,"y":260,"wires":[]},{"id":"6f444514.b1f43c","type":"ui_button","z":"a64b091a.a1bf2","name":"","group":"1495fa22.b16436","order":1,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":150,"y":300,"wires":[["8b5f6c04.3b618"]]},{"id":"2653648a.b6dbac","type":"function","z":"a64b091a.a1bf2","name":"","func":"message = msg.payload;\nvar daten = [];\nvar stunden = [];\nvar preise = [];\n\nfor(i = 0; i<message.length; i++){\n hour = new Date(message[i].start_timestamp);\n stunde = hour.getHours();\n price = message[i].marketprice/10;\n \n daten.push([price, hour]);\n stunden.push(stunde);\n preise.push(price);\n}\n\nbargraph = [{\n \"series\": [\"\"],\n \"data\": [preise],\n \"labels\": stunden\n}];\n\nreturn [{payload: daten}, {payload: bargraph}];\n","outputs":2,"noerr":0,"initialize":"","finalize":"","x":340,"y":460,"wires":[["a0bdf391.90198"],["4818bed5.a4f23","c776b0f.8d51dd"]]},{"id":"e155a845.29cf58","type":"switch","z":"a64b091a.a1bf2","name":"","property":"payload","propertyType":"msg","rules":[{"t":"istype","v":"array","vt":"array"}],"checkall":"true","repair":false,"outputs":1,"x":110,"y":460,"wires":[["2653648a.b6dbac"]]},{"id":"a0bdf391.90198","type":"debug","z":"a64b091a.a1bf2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":460,"wires":[]},{"id":"4818bed5.a4f23","type":"debug","z":"a64b091a.a1bf2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":610,"y":500,"wires":[]},{"id":"c776b0f.8d51dd","type":"ui_chart","z":"a64b091a.a1bf2","name":"","group":"1495fa22.b16436","order":1,"width":0,"height":0,"label":"ct/kWh","chartType":"bar","legend":"false","xformat":"auto","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":true,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":620,"y":540,"wires":[[]]},{"id":"1495fa22.b16436","type":"ui_group","name":"Standard","tab":"f420fdaa.3226a8","order":1,"disp":true,"width":"20","collapse":false},{"id":"f420fdaa.3226a8","type":"ui_tab","name":"aWATTar","icon":"dashboard","disabled":false,"hidden":false}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment