Here is a solution in Node RED to read the EPEX prognosis from the free aWATTar API and integrate it directly into HA:
[{"id":"c7fccfcd.3bb33","type":"tab","label":"EPEX Spot","disabled":false,"info":""},{"id":"9a3bb6ba.210408","type":"http request","z":"c7fccfcd.3bb33","name":"EPEX Spot Preise von aWATTar abfragen","method":"GET","ret":"obj","paytoqs":"query","url":"https://api.awattar.at/v1/marketdata","tls":"","persist":false,"proxy":"","authType":"","x":400,"y":220,"wires":[["5dc686e.1cebb78","d6514597.c36ab8"]]},{"id":"c61b8743.1663c8","type":"inject","z":"c7fccfcd.3bb33","name":"Immer zur vollen Stunde","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"0 0-23 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":100,"wires":[["2b7c38bf.0fd5d8"]]},{"id":"bdeb79c3.d8e0b8","type":"comment","z":"c7fccfcd.3bb33","name":"EPEX SPOT über aWATTar API...","info":"JSON-API:\nhttps://api.awattar.at/v1/marketdata\nhttps://api.awattar.at/v1/marketdata?start=1628139600000&end=1628226000000\n\n100 Requests pro Tag kostenlos\n\nBeschreibung aller aWATTar-APIs:\nhttps://www.awattar.at/services/api","x":170,"y":40,"wires":[]},{"id":"e51c5079.28ff3","type":"ha-entity","z":"c7fccfcd.3bb33","name":"epex_spot_price","server":"cb38d2a3.10198","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"epex_spot_price"},{"property":"device_class","value":""},{"property":"icon","value":"hass:chart-line"},{"property":"unit_of_measurement","value":"ct/kWh"}],"state":"payload","stateType":"msg","attributes":[{"property":"Hour 00-01","value":"hour00","valueType":"msg"},{"property":"Hour 01-02","value":"hour01","valueType":"msg"},{"property":"Hour 02-03","value":"hour02","valueType":"msg"},{"property":"Hour 03-04","value":"hour03","valueType":"msg"},{"property":"Hour 04-05","value":"hour04","valueType":"msg"},{"property":"Hour 05-06","value":"hour05","valueType":"msg"},{"property":"Hour 06-07","value":"hour06","valueType":"msg"},{"property":"Hour 07-08","value":"hour07","valueType":"msg"},{"property":"Hour 08-09","value":"hour08","valueType":"msg"},{"property":"Hour 09-10","value":"hour09","valueType":"msg"},{"property":"Hour 10-11","value":"hour10","valueType":"msg"},{"property":"Hour 11-12","value":"hour11","valueType":"msg"},{"property":"Hour 12-13","value":"hour12","valueType":"msg"},{"property":"Hour 13-14","value":"hour13","valueType":"msg"},{"property":"Hour 14-15","value":"hour14","valueType":"msg"},{"property":"Hour 15-16","value":"hour15","valueType":"msg"},{"property":"Hour 16-17","value":"hour16","valueType":"msg"},{"property":"Hour 17-18","value":"hour17","valueType":"msg"},{"property":"Hour 18-19","value":"hour18","valueType":"msg"},{"property":"Hour 19-20","value":"hour19","valueType":"msg"},{"property":"Hour 20-21","value":"hour20","valueType":"msg"},{"property":"Hour 21-22","value":"hour21","valueType":"msg"},{"property":"Hour 22-23","value":"hour22","valueType":"msg"},{"property":"Hour 23-24","value":"hour23","valueType":"msg"},{"property":"Hour \\+00","value":"hourRel00","valueType":"msg"},{"property":"Hour \\+01","value":"hourRel01","valueType":"msg"},{"property":"Hour \\+02","value":"hourRel02","valueType":"msg"},{"property":"Hour \\+03","value":"hourRel03","valueType":"msg"},{"property":"Hour \\+04","value":"hourRel04","valueType":"msg"},{"property":"Hour \\+05","value":"hourRel05","valueType":"msg"},{"property":"Hour \\+06","value":"hourRel06","valueType":"msg"},{"property":"Hour \\+07","value":"hourRel07","valueType":"msg"},{"property":"Hour \\+08","value":"hourRel08","valueType":"msg"},{"property":"Hour \\+09","value":"hourRel09","valueType":"msg"},{"property":"Hour \\+10","value":"hourRel10","valueType":"msg"},{"property":"Hour \\+11","value":"hourRel11","valueType":"msg"},{"property":"Hour \\+12","value":"hourRel12","valueType":"msg"},{"property":"Hour \\+13","value":"hourRel13","valueType":"msg"},{"property":"Hour \\+14","value":"hourRel14","valueType":"msg"},{"property":"Hour \\+15","value":"hourRel15","valueType":"msg"},{"property":"Hour \\+16","value":"hourRel16","valueType":"msg"},{"property":"Hour \\+17","value":"hourRel17","valueType":"msg"},{"property":"Hour \\+18","value":"hourRel18","valueType":"msg"},{"property":"Hour \\+19","value":"hourRel19","valueType":"msg"},{"property":"Hour \\+20","value":"hourRel20","valueType":"msg"},{"property":"Hour \\+21","value":"hourRel21","valueType":"msg"},{"property":"Hour \\+22","value":"hourRel22","valueType":"msg"},{"property":"Hour \\+23","value":"hourRel23","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":320,"y":400,"wires":[[]]},{"id":"d6514597.c36ab8","type":"function","z":"c7fccfcd.3bb33","name":"Daten erhalten?","func":"if(\n typeof msg.payload === \"object\" && \n msg.payload.data &&\n msg.payload.data.length>0\n){\n return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":280,"wires":[["dffb3653.a7d7b8"]]},{"id":"5dc686e.1cebb78","type":"debug","z":"c7fccfcd.3bb33","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":650,"y":220,"wires":[]},{"id":"dffb3653.a7d7b8","type":"function","z":"c7fccfcd.3bb33","name":"Loop über 24 Werte für kommende Stunden, Daten aufbereiten in getrennten msg-Properties","func":"let data = msg.payload.data;\n\nlet nowDate = new Date();\nlet nowHours = nowDate.getHours();\ndata.forEach((oHourSlice, i) => {\n let startDate = new Date(oHourSlice.start_timestamp);\n let startHourLocal = (\"0\" + startDate.getHours()).slice(-2);\n let startHourLocalRel = (\"0\" + ((startDate.getHours()-nowDate.getHours()+24) % 24)).slice(-2);\n let endDate = new Date(oHourSlice.end_timestamp);\n let endHourLocal = (\"0\" + endDate.getHours()).slice(-2);\n let startHourLocalRelRel = (\"0\" + ((endDate.getHours()-nowDate.getHours()+24) % 24)).slice(-2);\n // Eur/MWh => ct/kWh\n let hourPriceInCt = (oHourSlice.marketprice/10).toFixed(2); \n if(nowHours>=startHourLocal && nowHours<endHourLocal){\n msg.payload = hourPriceInCt;\n }\n msg[\"hour\"+startHourLocal] = hourPriceInCt;\n msg[\"hourRel\"+startHourLocalRel] = hourPriceInCt;\n\n //node.warn(oHourSlice);\n //node.warn(startHourLocal);\n //node.warn(endHourLocal);\n //node.warn(hourPriceInCt);\n});\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":340,"wires":[["824c2a75.497688","e51c5079.28ff3"]]},{"id":"824c2a75.497688","type":"debug","z":"c7fccfcd.3bb33","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":690,"y":400,"wires":[]},{"id":"2b7c38bf.0fd5d8","type":"function","z":"c7fccfcd.3bb33","name":"payload.start = lastFullHour; payload.end = lastFullHour+24","func":"let lastFullHour = new Date();\nlastFullHour.setMinutes(0);\nlastFullHour.setSeconds(0);\nlastFullHour.setMilliseconds(0);\n\nlet startdate = lastFullHour.getTime();\nlet enddate = startdate + 24*3600*1000;\n\n//node.warn(startdate);\n//node.warn(enddate);\n\nmsg = {\n payload: {\n start: startdate,\n end: enddate\n }\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":160,"wires":[["9a3bb6ba.210408","8e226df8.f6851"]]},{"id":"8e226df8.f6851","type":"debug","z":"c7fccfcd.3bb33","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":770,"y":160,"wires":[]},{"id":"25d4e0ed.20c31","type":"inject","z":"c7fccfcd.3bb33","name":"Test","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":160,"wires":[["2b7c38bf.0fd5d8"]]},{"id":"cb38d2a3.10198","type":"server","name":"Home Assistant"}]
The result is a HA entity sensor.epex_spot_price
that holds the current EPEX price as state and the upcoming prices as attributes. Values are in ct/kWh.
For convenience each hourly price is contained twice in the attributes:
- With key “Hour nn-mm” that contains the hour interval as starting hour (nn) and ending hour (mm) in 24h scheme.
- With key “Hour +nn” that contains the relative hour from now.