I have created a node red flow that connects to n3rgy early each morning and pulls back the last 24 hours of data. It writes each 30 minute reading directly into influxdb with the correct timestamp (and grafana can then pull this out)
It also sums the elec consumption, export and gas consumption into 3 separate HA sensors e.g. yday_elec_in. The MAC address of your IHD is configured in the first node (the inject timer)
[{"id":"77496a2a.c76484","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"bea6e51f.bebff8","type":"inject","z":"77496a2a.c76484","name":"","props":[{"p":"headers.Authorization","v":"yourIHDMAC","vt":"str"}],"repeat":"","crontab":"15 06 * * *","once":false,"onceDelay":0.1,"topic":"","x":160,"y":220,"wires":[["4382bbc1.39bbd4","d4803192.2ef7b","1deddef.40a9f21"]]},{"id":"4382bbc1.39bbd4","type":"http request","z":"77496a2a.c76484","name":"http elec used","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://consumer-api.data.n3rgy.com/electricity/consumption/1","tls":"","persist":false,"proxy":"","authType":"","x":370,"y":220,"wires":[["44e170ed.28da6","1f305bc2.f76894"]]},{"id":"d4803192.2ef7b","type":"http request","z":"77496a2a.c76484","name":"http gas used","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://consumer-api.data.n3rgy.com/gas/consumption/1","tls":"","persist":false,"proxy":"","authType":"","x":360,"y":340,"wires":[["28d6fb7c.1b8e14"]]},{"id":"1deddef.40a9f21","type":"http request","z":"77496a2a.c76484","name":"http elec generated","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://consumer-api.data.n3rgy.com/electricity/production/1","tls":"","persist":false,"proxy":"","authType":"","x":370,"y":420,"wires":[["4dc11d0.8103de4"]]},{"id":"44e170ed.28da6","type":"function","z":"77496a2a.c76484","name":"","func":"var i = 0;\nvar total = 0;\nlet temp = [];\nvar value_list = [];\nvar status_list = [];\nvar temptime = \"\"\nvar msgout1 = {};\nvar msgout2 = {};\nfor (i=0; i< msg.payload.values.length; i++) {\n temptime = msg.payload.values[i].timestamp;\n if (temptime.length==16) {\n temptime = temptime.replace(\" \",\"T\") + \":00.000Z\";\n }\n temp.push(\n {\n measurement: \"Metered_Energy\",\n fields: {\n kWh_in: msg.payload.values[i].value\n },\n tags: {\n type: \"electricity_consumed\" \n },\n timestamp: Date.parse(temptime)*1000000\n } \n ) \ntotal = total + msg.payload.values[i].value; \n}\n\nif ( msg.payload.values.length == 48) {\n msgout2.payload = total;}\nelse {\n msgout2.payload = msg.payload.values.length\n} \n\n \nmsgout1.payload = temp;\nreturn [msgout1, msgout2];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":260,"wires":[["add86f5a.cefa"],["87f197e7.c5d868"]]},{"id":"add86f5a.cefa","type":"influxdb batch","z":"77496a2a.c76484","influxdb":"1aba0ec9.6819b1","precision":"","retentionPolicy":"","name":"homeassistant_daily","database":"database","precisionV18FluxV20":"s","retentionPolicyV18Flux":"","org":"homeassistant","bucket":"bucket","x":930,"y":360,"wires":[]},{"id":"28d6fb7c.1b8e14","type":"function","z":"77496a2a.c76484","name":"","func":"var i = 0;\nvar total = 0;\nlet temp = [];\nvar temptime = \"\"\nvar msgout1 = {};\nvar msgout2 = {};\nfor (i=0; i< msg.payload.values.length; i++) {\n temptime = msg.payload.values[i].timestamp;\n if (temptime.length==16) {\n temptime = temptime.replace(\" \",\"T\") + \":00.000Z\";\n }\n temp.push(\n {\n measurement: \"Metered_Energy\",\n fields: {\n m3: msg.payload.values[i].value\n },\n tags: {\n type: \"gas_consumed\" \n },\n timestamp: Date.parse(temptime)*1000000\n } \n ) \ntotal = total + msg.payload.values[i].value; \n}\n\nif ( msg.payload.values.length == 48) {\n msgout2.payload = total;}\nelse {\n msgout2.payload = 0\n} \n\n \nmsgout1.payload = temp;\nreturn [msgout1, msgout2];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":320,"wires":[["add86f5a.cefa"],["867101a9.0a90f"]]},{"id":"4dc11d0.8103de4","type":"function","z":"77496a2a.c76484","name":"","func":"var i = 0;\nvar total = 0;\nlet temp = [];\nvar temptime = \"\"\nvar msgout1 = {};\nvar msgout2 = {};\ntry{\nfor (i=0; i< msg.payload.values.length; i++) {\n temptime = msg.payload.values[i].timestamp;\n if (temptime.length==16) {\n temptime = temptime.replace(\" \",\"T\") + \":00.000Z\";\n }\n temp.push(\n {\n measurement: \"Metered_Energy\",\n fields: {\n kWh_out: msg.payload.values[i].value\n },\n tags: {\n type: \"electricity_exported\" \n },\n timestamp: Date.parse(temptime)*1000000\n } \n ) \ntotal = total + msg.payload.values[i].value; \n}\n\nif ( msg.payload.values.length == 48) {\n msgout2.payload = total;}\nelse {\n msgout2.payload = 0\n} \n\n \nmsgout1.payload = temp;\nreturn [msgout1, msgout2];\n\n} catch (e) {\n return null\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":460,"wires":[["add86f5a.cefa"],["6ba7217d.e6764"]]},{"id":"1f305bc2.f76894","type":"debug","z":"77496a2a.c76484","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":580,"y":160,"wires":[]},{"id":"87f197e7.c5d868","type":"ha-entity","z":"77496a2a.c76484","name":"yday_elec_in","server":"d0eba65d.81fba8","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"yday_elec_in"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"kWh"}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":910,"y":420,"wires":[[]]},{"id":"867101a9.0a90f","type":"ha-entity","z":"77496a2a.c76484","name":"yday_gas_in","server":"d0eba65d.81fba8","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"yday_gas_in"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"m3"}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":910,"y":480,"wires":[[]]},{"id":"6ba7217d.e6764","type":"ha-entity","z":"77496a2a.c76484","name":"yday_elec_out","server":"d0eba65d.81fba8","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"yday_elec_out"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"kWh"}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":920,"y":540,"wires":[[]]},{"id":"300cbfb6.a5169","type":"debug","z":"77496a2a.c76484","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":910,"y":660,"wires":[]},{"id":"1aba0ec9.6819b1","type":"influxdb","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"homeassistant","name":"homeassistant","usetls":false,"tls":"78605c47.6ab364","influxdbVersion":"1.x","url":"http://localhost:8086","rejectUnauthorized":true},{"id":"d0eba65d.81fba8","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"78605c47.6ab364","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false}]