Voltego flow

Here's a flow that will allow you to get Voltego (https://www.voltego.de/) API running. You'll have to have a client_id as well as a client_secret that you need to ask for at [email protected] and you need to be a customer.

The "store secrets" node will need to contain your is and secret.

[{"id":"bc8b74e139b3e80f","type":"tab","label":"Voltego2","disabled":false,"info":"","env":[]},{"id":"1f1d03c2.eb22dc","type":"function","z":"bc8b74e139b3e80f","name":"token request","func":"msg.method = \"POST\" \nmsg.url = 'https://api.voltego.de/oauth/token'\n\nmsg.headers ={\n    \"Content-Type\": \"application/json\"\n}\nmsg.payload = {\n \"grant_type\":      \"client_credentials\",\n \"scope\":           \"market_data:read\",\n \"client_id\":       flow.get(\"client_id\"),\n \"client_secret\":   flow.get(\"client_secret\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":80,"wires":[["112114bd.3f7bf3"]]},{"id":"112114bd.3f7bf3","type":"http request","z":"bc8b74e139b3e80f","name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":670,"y":80,"wires":[["ea62a07e79ea7dbd"]]},{"id":"c4f45a89.bcb1d8","type":"debug","z":"bc8b74e139b3e80f","name":"access token","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.access_token","targetType":"msg","statusVal":"","statusType":"auto","x":1150,"y":80,"wires":[]},{"id":"ea62a07e79ea7dbd","type":"json","z":"bc8b74e139b3e80f","name":"","property":"payload","action":"","pretty":true,"x":810,"y":80,"wires":[["1b3fabe6349bde5f"]]},{"id":"133d17662bbab20a","type":"debug","z":"bc8b74e139b3e80f","name":"market data indication","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1120,"y":200,"wires":[]},{"id":"12e2eb915353d72e","type":"http request","z":"bc8b74e139b3e80f","name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":750,"y":200,"wires":[["791b7ca0f76e71a0"]]},{"id":"791b7ca0f76e71a0","type":"json","z":"bc8b74e139b3e80f","name":"","property":"payload","action":"","pretty":false,"x":910,"y":200,"wires":[["133d17662bbab20a"]]},{"id":"5512338bcce23062","type":"debug","z":"bc8b74e139b3e80f","name":"debug 8","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"url","targetType":"msg","statusVal":"","statusType":"auto","x":720,"y":240,"wires":[]},{"id":"9da1e3a398e6fb05","type":"inject","z":"bc8b74e139b3e80f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":200,"wires":[["3a6fa6ac834ee7cc"]]},{"id":"1b3fabe6349bde5f","type":"function","z":"bc8b74e139b3e80f","name":"store","func":"flow.set(\"token\",msg.payload);\nflow.set(\"datetime\",(new Date().getTime()-1)*1000000);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":80,"wires":[["c4f45a89.bcb1d8"]]},{"id":"3a6fa6ac834ee7cc","type":"function","z":"bc8b74e139b3e80f","name":"check","func":"var token = flow.get(\"token\").access_token;\nvar expires = flow.get(\"token\").expires_in;\nvar datetime = flow.get(\"datetime\");\nvar now = (new Date().getTime()-1)*1000000;\n\nmsg.payload={\n    \"access_token\": token,\n    \"expires\": expires,\n    \"datetime\": datetime,\n    \"now\":now,\n    \"expiration_after\": (now+expires)\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":200,"wires":[["1f495623d1f17158","2788aeb54626a7a9"]]},{"id":"1f495623d1f17158","type":"json","z":"bc8b74e139b3e80f","name":"","property":"payload","action":"","pretty":false,"x":450,"y":200,"wires":[["525879d14883f281"]]},{"id":"6232df05f2120285","type":"inject","z":"bc8b74e139b3e80f","name":"get token","props":[],"repeat":"86400","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":80,"wires":[["0eb59b4f44d3c228"]]},{"id":"0eb59b4f44d3c228","type":"function","z":"bc8b74e139b3e80f","name":"store secrets","func":"flow.set(\"client_id\",\"<cliet id goes here>\");\nflow.set(\"client_secret\",\"<secret goes here>\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":80,"wires":[["1f1d03c2.eb22dc"]]},{"id":"525879d14883f281","type":"function","z":"bc8b74e139b3e80f","name":"request","func":"var token = flow.get(\"token\").access_token\nmsg.payload={}\nmsg.method=\"GET\",\n//msg.url='https://api.voltego.de/market_data/day_ahead/DE_LU/60?from=2023-03-20T00:00:00+01:00',\n//msg.url='https://api.voltego.de/market_data/day_ahead/DE_LU/60?tz=UTC+01:00&from=2023-03-20T00:00:00+01:00&unit=EUR-ct_kWh',\nmsg.url=\"https://api.voltego.de/market_data/indication?\"\n    +\"market_segment=\"+flow.get(\"market_segment\")+\"&\"\n    +\"product=\"+flow.get(\"product\"),+\"&\"\n    +\"unit=\"+flow.get(\"unit\")+\"&\"\n    +\"months\"+flow.get(\"months\")\nmsg.headers={\n        \"Authorization\": token\n    }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":200,"wires":[["12e2eb915353d72e","5512338bcce23062"]]},{"id":"3843a379397ba8d4","type":"inject","z":"bc8b74e139b3e80f","name":"market_segment","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":160,"y":300,"wires":[["7be1e53018605a32"]]},{"id":"9a34cb731482f753","type":"inject","z":"bc8b74e139b3e80f","name":"market_segment","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":160,"y":360,"wires":[["6afcf7027ebc77ba"]]},{"id":"8b8b14dd7dbe8996","type":"debug","z":"bc8b74e139b3e80f","name":"market_segment","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":360,"wires":[]},{"id":"7be1e53018605a32","type":"function","z":"bc8b74e139b3e80f","name":"day_ahead","func":"flow.set(\"market_segment\",\"day_ahead\")\nmsg.payload={\n    \"market_segment\": flow.get(\"market_segment\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":300,"wires":[["8b8b14dd7dbe8996"]]},{"id":"6afcf7027ebc77ba","type":"function","z":"bc8b74e139b3e80f","name":"intraday","func":"flow.set(\"market_segment\",\"intraday\")\nmsg.payload={\n    \"market_segment\": flow.get(\"market_segment\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":360,"wires":[["8b8b14dd7dbe8996"]]},{"id":"d142ee87ad63ebb4","type":"comment","z":"bc8b74e139b3e80f","name":"toggle market_segment","info":"this toggles between the market segment between intraday and day-ahead","x":160,"y":260,"wires":[]},{"id":"b06b934169568117","type":"inject","z":"bc8b74e139b3e80f","name":"product","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":440,"wires":[["2badb2c24c2df8f2"]]},{"id":"b6c5d34b0d613166","type":"inject","z":"bc8b74e139b3e80f","name":"product","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":500,"wires":[["611c74a1070cff0d"]]},{"id":"a2012f76a270511c","type":"debug","z":"bc8b74e139b3e80f","name":"product","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":540,"y":500,"wires":[]},{"id":"2badb2c24c2df8f2","type":"function","z":"bc8b74e139b3e80f","name":"15","func":"flow.set(\"product\",\"15\")\nmsg.payload={\n    \"product\": flow.get(\"product\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":440,"wires":[["a2012f76a270511c"]]},{"id":"611c74a1070cff0d","type":"function","z":"bc8b74e139b3e80f","name":"60","func":"flow.set(\"product\",\"60\")\nmsg.payload={\n    \"market_segment\": flow.get(\"product\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":500,"wires":[["a2012f76a270511c"]]},{"id":"eaad0485f624077f","type":"inject","z":"bc8b74e139b3e80f","name":"unit","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":800,"wires":[["3e4073a9909613ee"]]},{"id":"46b5cf6f4ff9e4b0","type":"debug","z":"bc8b74e139b3e80f","name":"units","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":860,"wires":[]},{"id":"3e4073a9909613ee","type":"function","z":"bc8b74e139b3e80f","name":"EUR_Wh","func":"flow.set(\"unit\",\"EUR_Wh\")\nmsg.payload={\n    \"unit\": flow.get(\"unit\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":800,"wires":[["46b5cf6f4ff9e4b0"]]},{"id":"dc82d1921e93ede8","type":"inject","z":"bc8b74e139b3e80f","name":"unit","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":840,"wires":[["ae5d637cc2dbb907"]]},{"id":"ae5d637cc2dbb907","type":"function","z":"bc8b74e139b3e80f","name":"EUR_kWh","func":"flow.set(\"unit\",\"EUR_kWh\")\nmsg.payload={\n    \"unit\": flow.get(\"unit\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":840,"wires":[["46b5cf6f4ff9e4b0"]]},{"id":"88f10986c6fb2b87","type":"inject","z":"bc8b74e139b3e80f","name":"unit","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":880,"wires":[["59530ff5de1a9f92"]]},{"id":"59530ff5de1a9f92","type":"function","z":"bc8b74e139b3e80f","name":"EUR_MWh","func":"flow.set(\"unit\",\"EUR_MWh\")\nmsg.payload={\n    \"unit\": flow.get(\"unit\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":880,"wires":[["46b5cf6f4ff9e4b0"]]},{"id":"57bdf52e159dd48c","type":"inject","z":"bc8b74e139b3e80f","name":"unit","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":920,"wires":[["c90a1447acd43023"]]},{"id":"c90a1447acd43023","type":"function","z":"bc8b74e139b3e80f","name":"EUR-ct_kWh","func":"flow.set(\"unit\",\"EUR-ct_kWh\")\nmsg.payload={\n    \"unit\": flow.get(\"unit\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":920,"wires":[["46b5cf6f4ff9e4b0"]]},{"id":"ce4191e7aad8398f","type":"comment","z":"bc8b74e139b3e80f","name":"enter secrets here","info":"","x":330,"y":40,"wires":[]},{"id":"62d0e4ca3e13b0a0","type":"comment","z":"bc8b74e139b3e80f","name":"toggle product","info":"this toggles between the product 25 min or 60 min, whereas 60min are default","x":140,"y":400,"wires":[]},{"id":"2788aeb54626a7a9","type":"debug","z":"bc8b74e139b3e80f","name":"debug 9","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":480,"y":140,"wires":[]},{"id":"38f37c6d67f9d38e","type":"comment","z":"bc8b74e139b3e80f","name":"toggle units","info":"doesn't seem to have any impact","x":130,"y":740,"wires":[]},{"id":"3b6efa570dc9cbf1","type":"inject","z":"bc8b74e139b3e80f","name":"1","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":750,"y":780,"wires":[["1e6bc16d9ac1d581"]]},{"id":"3e76c73ed4187bbb","type":"inject","z":"bc8b74e139b3e80f","name":"6","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":750,"y":840,"wires":[["7fe233e527f45f79"]]},{"id":"483d326410e6fbfd","type":"debug","z":"bc8b74e139b3e80f","name":"months","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1160,"y":840,"wires":[]},{"id":"1e6bc16d9ac1d581","type":"function","z":"bc8b74e139b3e80f","name":"1 month","func":"flow.set(\"months\",1)\nmsg.payload={\n    \"months\": flow.get(\"months\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":960,"y":780,"wires":[["483d326410e6fbfd"]]},{"id":"7fe233e527f45f79","type":"function","z":"bc8b74e139b3e80f","name":"6 months","func":"flow.set(\"months\",6)\nmsg.payload={\n    \"months\": flow.get(\"months\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":960,"y":840,"wires":[["483d326410e6fbfd"]]},{"id":"7ff9e4ddce66f274","type":"comment","z":"bc8b74e139b3e80f","name":"toggle months","info":"this toggles between the history months, yet doesn't seem to have any impact","x":750,"y":740,"wires":[]},{"id":"cdfdd78c371c4494","type":"comment","z":"bc8b74e139b3e80f","name":"market data indication","info":"","x":160,"y":160,"wires":[]},{"id":"3969670fe8f862bc","type":"comment","z":"bc8b74e139b3e80f","name":"click to get token","info":"","x":140,"y":40,"wires":[]},{"id":"e776f28ffbad819c","type":"debug","z":"bc8b74e139b3e80f","name":"market data indication","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1120,"y":640,"wires":[]},{"id":"68c6818a8d77a81f","type":"http request","z":"bc8b74e139b3e80f","name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":750,"y":640,"wires":[["e72baf95425b4050"]]},{"id":"e72baf95425b4050","type":"json","z":"bc8b74e139b3e80f","name":"","property":"payload","action":"","pretty":false,"x":910,"y":640,"wires":[["e776f28ffbad819c"]]},{"id":"409c1d5a8142f975","type":"debug","z":"bc8b74e139b3e80f","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"url","targetType":"msg","statusVal":"","statusType":"auto","x":740,"y":680,"wires":[]},{"id":"db5c22b2240c64cc","type":"inject","z":"bc8b74e139b3e80f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":640,"wires":[["564dfbf23a0d6c77"]]},{"id":"564dfbf23a0d6c77","type":"function","z":"bc8b74e139b3e80f","name":"check","func":"var token = flow.get(\"token\").access_token;\nvar expires = flow.get(\"token\").expires_in;\nvar datetime = flow.get(\"datetime\");\nvar now = (new Date().getTime()-1)*1000000;\n\nmsg.payload={\n    \"access_token\": token,\n    \"expires\": expires,\n    \"datetime\": datetime,\n    \"now\":now,\n    \"expiration_after\": (now+expires)\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":640,"wires":[["1865cbb4eea6c901","ed56ee1e88bcff87"]]},{"id":"1865cbb4eea6c901","type":"json","z":"bc8b74e139b3e80f","name":"","property":"payload","action":"","pretty":false,"x":450,"y":640,"wires":[["2d0b9cf093e0c110"]]},{"id":"2d0b9cf093e0c110","type":"function","z":"bc8b74e139b3e80f","name":"request","func":"var token = flow.get(\"token\").access_token\nmsg.payload={}\nmsg.method=\"GET\",\n//msg.url='https://api.voltego.de/market_data/day_ahead/DE_LU/60?from=2023-03-20T00:00:00+01:00',\n//msg.url='https://api.voltego.de/market_data/day_ahead/DE_LU/60?tz=UTC+01:00&from=2023-03-20T00:00:00+01:00&unit=EUR-ct_kWh',\nmsg.url=\"https://api.voltego.de/market_data/\"\n    +flow.get(\"market_segment\")+\"/DE_LU/\" // market_area\n    +flow.get(\"product\"),+\"?\"\n    +\"unit=\"+flow.get(\"unit\")+\"&\"\n    +\"months\"+flow.get(\"months\")\nmsg.headers={\n        \"Authorization\": token\n    }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":640,"wires":[["68c6818a8d77a81f","409c1d5a8142f975"]]},{"id":"ed56ee1e88bcff87","type":"debug","z":"bc8b74e139b3e80f","name":"debug 11","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":480,"y":580,"wires":[]},{"id":"c64318be01a3bb79","type":"comment","z":"bc8b74e139b3e80f","name":"some fiddling around","info":"","x":160,"y":600,"wires":[]},{"id":"0f69093607bb790c","type":"inject","z":"bc8b74e139b3e80f","name":"1","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":750,"y":1020,"wires":[["653adef6729efe78"]]},{"id":"c501bbd8831ba696","type":"inject","z":"bc8b74e139b3e80f","name":"6","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":750,"y":1080,"wires":[["77491981e69ba1ec"]]},{"id":"23fd91e7afa896fb","type":"debug","z":"bc8b74e139b3e80f","name":"months","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1160,"y":1080,"wires":[]},{"id":"653adef6729efe78","type":"function","z":"bc8b74e139b3e80f","name":"1 month","func":"flow.set(\"months\",1)\nmsg.payload={\n    \"months\": flow.get(\"months\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":960,"y":1020,"wires":[["23fd91e7afa896fb"]]},{"id":"77491981e69ba1ec","type":"function","z":"bc8b74e139b3e80f","name":"6 months","func":"flow.set(\"months\",6)\nmsg.payload={\n    \"months\": flow.get(\"months\")\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":960,"y":1080,"wires":[["23fd91e7afa896fb"]]},{"id":"022cbaf4a9593d32","type":"comment","z":"bc8b74e139b3e80f","name":"toggle months","info":"this toggles between the history months, yet doesn't seem to have any impact","x":750,"y":980,"wires":[]}]

Flow Info

Created 2 years, 3 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x9)
  • debug (x12)
  • function (x19)
  • http request (x3)
  • inject (x15)
  • json (x5)
Other
  • tab (x1)

Tags

  • inspirational
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option