Octopus UK Flux Calculator

This flow will look at your consumption data from 2022 and rate the costs based on the new Flux tarrif.

Its designed for users who are already on the Tesla Energy Plan which has now been discontinued and replaced with Flux.

A few caveats:

  • These flux rates so far are the national averages, so there will be regional variaions I imagine, I’m in the South West whcih is a more expensive region.
  • The flow doesn't take into account the shift between BST & GMT as the Octopus API returns UTC all the time and timezone stuff is hard!
  • I’ve not taken into account standing charges as these are basically the same on any tarrif

This assumes that the import and export pattern will be the same when you setup your powerwall for Time of Use as it was on TEP under Teslas control

You will need an Octopus API key for your account from https://octopus.energy/dashboard/developer/ Along with your electricity meter Serial number and your import and export MPANs, these can be found in your Octopus account

[{"id":"f6ba8b7b30f4e2cb","type":"http request","z":"4c90073d297b222d","name":"GET Import","method":"GET","ret":"obj","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":830,"y":380,"wires":[["3a6f17a9f31e9c35"]]},{"id":"5ebe88b7b1ec9cb8","type":"split","z":"4c90073d297b222d","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1190,"y":380,"wires":[["150dbdca01686331"]]},{"id":"3a6f17a9f31e9c35","type":"change","z":"4c90073d297b222d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.results","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":380,"wires":[["5ebe88b7b1ec9cb8"]]},{"id":"636a06998edd1f09","type":"template","z":"4c90073d297b222d","name":"","field":"url","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"https://{{apikey}}:@api.octopus.energy/v1/electricity-meter-points/{{importmpan}}/meters/{{meter}}/consumption","output":"str","x":680,"y":380,"wires":[["f6ba8b7b30f4e2cb"]]},{"id":"5ebc13f0ad75b45f","type":"inject","z":"4c90073d297b222d","name":"Set MPANs, Meter ID, API Key and Dates","props":[{"p":"payload.period_from","v":"2022-01-01T00:00:00+0100","vt":"str"},{"p":"payload.period_to","v":"2022-12-31T23:59:00+0100","vt":"str"},{"p":"payload.page_size","v":"20000","vt":"str"},{"p":"apikey","v":"sk_live_XXXXXXXXXXXX","vt":"str"},{"p":"meter","v":"XXXXXXX","vt":"str"},{"p":"importmpan","v":"XXXXXXXXXXXX","vt":"str"},{"p":"exportmpan","v":"XXXXXXXXXXXX","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":220,"y":500,"wires":[["0497ba7168f88387","3f56243c23dca03a"]]},{"id":"a599f6d61a1e4469","type":"http request","z":"4c90073d297b222d","name":"GET Export","method":"GET","ret":"obj","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":850,"y":620,"wires":[["4fc0c7e303bf879a"]]},{"id":"beebeb2ba7f668aa","type":"split","z":"4c90073d297b222d","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1190,"y":620,"wires":[["75b2d6fe7ca089d2"]]},{"id":"4fc0c7e303bf879a","type":"change","z":"4c90073d297b222d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.results","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":620,"wires":[["beebeb2ba7f668aa"]]},{"id":"e85286e9a179c6a0","type":"template","z":"4c90073d297b222d","name":"","field":"url","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"https://{{apikey}}:@api.octopus.energy/v1/electricity-meter-points/{{exportmpan}}/meters/{{meter}}/consumption","output":"str","x":680,"y":620,"wires":[["a599f6d61a1e4469"]]},{"id":"150dbdca01686331","type":"change","z":"4c90073d297b222d","name":"","rules":[{"t":"set","p":"payload.start","pt":"msg","to":"$number($split($replace($split(payload.interval_start, \"T\")[1], \"Z\", ''), \":\")[0])\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1380,"y":380,"wires":[["8d9859e2c7b62231"]]},{"id":"8d9859e2c7b62231","type":"switch","z":"4c90073d297b222d","name":"","property":"payload.start","propertyType":"msg","rules":[{"t":"btwn","v":"2","vt":"num","v2":"4","v2t":"num"},{"t":"btwn","v":"16","vt":"num","v2":"18","v2t":"num"},{"t":"else"}],"checkall":"false","repair":false,"outputs":3,"x":1550,"y":380,"wires":[["f111a4d48f940eb1"],["c3221a2ded9c6b7a"],["9080b04015b4d633"]]},{"id":"75b2d6fe7ca089d2","type":"change","z":"4c90073d297b222d","name":"","rules":[{"t":"set","p":"payload.start","pt":"msg","to":"$number($split($replace($split(payload.interval_start, \"T\")[1], \"Z\", ''), \":\")[0])\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1380,"y":620,"wires":[["3abde9c03ef68fde"]]},{"id":"3abde9c03ef68fde","type":"switch","z":"4c90073d297b222d","name":"","property":"payload.start","propertyType":"msg","rules":[{"t":"btwn","v":"2","vt":"num","v2":"4","v2t":"num"},{"t":"btwn","v":"16","vt":"num","v2":"18","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1550,"y":620,"wires":[["399d9787c6742e7a"],["d9a75129aa874acb"],["8746417be566a715"]]},{"id":"f111a4d48f940eb1","type":"change","z":"4c90073d297b222d","name":"Rate Off-Peak","rules":[{"t":"set","p":"payload.rate","pt":"msg","to":"20.4","tot":"num"},{"t":"set","p":"payload.cost","pt":"msg","to":"payload.consumption*payload.rate","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"offpeak","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1800,"y":340,"wires":[["a0c60a62d0036298"]]},{"id":"c3221a2ded9c6b7a","type":"change","z":"4c90073d297b222d","name":"Rate Peak","rules":[{"t":"set","p":"payload.rate","pt":"msg","to":"47.5","tot":"num"},{"t":"set","p":"payload.cost","pt":"msg","to":"payload.consumption*payload.rate","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"peak","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1790,"y":380,"wires":[["a0c60a62d0036298"]]},{"id":"9080b04015b4d633","type":"change","z":"4c90073d297b222d","name":"Rate Daytime","rules":[{"t":"set","p":"payload.rate","pt":"msg","to":"34","tot":"num"},{"t":"set","p":"payload.cost","pt":"msg","to":"payload.consumption*payload.rate","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"day","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1800,"y":420,"wires":[["a0c60a62d0036298"]]},{"id":"a0c60a62d0036298","type":"function","z":"4c90073d297b222d","name":"Sum","func":"var t = flow.get(msg.topic);\nt += msg.payload.cost\nflow.set(msg.topic, t)\nmsg.total = t\nvar i = flow.get(\"import\");\ni += msg.payload.consumption\nflow.set(\"import\", i)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2030,"y":380,"wires":[["b2b3bec857d0ed36"]]},{"id":"0497ba7168f88387","type":"change","z":"4c90073d297b222d","name":"","rules":[{"t":"set","p":"peak","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"offpeak","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"day","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"import","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":380,"wires":[["636a06998edd1f09"]]},{"id":"b2b3bec857d0ed36","type":"join","z":"4c90073d297b222d","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":"false","timeout":"","count":"","reduceRight":false,"x":2150,"y":380,"wires":[["d29c40b0e805c4af"]]},{"id":"1205e9dd8b9d22f9","type":"debug","z":"4c90073d297b222d","name":"Totals Import","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"totals","targetType":"msg","statusVal":"","statusType":"auto","x":2510,"y":380,"wires":[]},{"id":"399d9787c6742e7a","type":"change","z":"4c90073d297b222d","name":"Rate Offpeak","rules":[{"t":"set","p":"payload.rate","pt":"msg","to":"9.4","tot":"num"},{"t":"set","p":"payload.cost","pt":"msg","to":"payload.consumption*payload.rate","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"offpeak","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1770,"y":580,"wires":[["7b88446f22b7c786"]]},{"id":"d9a75129aa874acb","type":"change","z":"4c90073d297b222d","name":"Rate Peak","rules":[{"t":"set","p":"payload.rate","pt":"msg","to":"36.5","tot":"num"},{"t":"set","p":"payload.cost","pt":"msg","to":"payload.consumption*payload.rate","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"peak","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1770,"y":620,"wires":[["7b88446f22b7c786"]]},{"id":"8746417be566a715","type":"change","z":"4c90073d297b222d","name":"Rate Daytime","rules":[{"t":"set","p":"payload.rate","pt":"msg","to":"23","tot":"num"},{"t":"set","p":"payload.cost","pt":"msg","to":"payload.consumption*payload.rate","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"day","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1780,"y":660,"wires":[["7b88446f22b7c786"]]},{"id":"7b88446f22b7c786","type":"function","z":"4c90073d297b222d","name":"Sum","func":"var t = flow.get(msg.topic);\nt += msg.payload.cost\nflow.set(msg.topic, t)\nmsg.total = t\nvar e = flow.get(\"export\");\ne += msg.payload.consumption\nflow.set(\"export\", e)\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2030,"y":620,"wires":[["88cfd5358ccfff11"]]},{"id":"88cfd5358ccfff11","type":"join","z":"4c90073d297b222d","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":"false","timeout":"","count":"","reduceRight":false,"x":2150,"y":620,"wires":[["8285dc624c35f5aa"]]},{"id":"887faf743172e5fd","type":"debug","z":"4c90073d297b222d","name":"Totals Export","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"totals","targetType":"msg","statusVal":"","statusType":"auto","x":2510,"y":620,"wires":[]},{"id":"3f56243c23dca03a","type":"change","z":"4c90073d297b222d","name":"","rules":[{"t":"set","p":"peak","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"offpeak","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"day","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"export","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":620,"wires":[["e85286e9a179c6a0"]]},{"id":"d29c40b0e805c4af","type":"change","z":"4c90073d297b222d","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"import","tot":"str"},{"t":"set","p":"totals","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"totals.day_cost","pt":"msg","to":"day","tot":"flow"},{"t":"set","p":"totals.offpeak_cost","pt":"msg","to":"offpeak","tot":"flow"},{"t":"set","p":"totals.peak_cost","pt":"msg","to":"peak","tot":"flow"},{"t":"set","p":"totals.import_kwh","pt":"msg","to":"import","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":2300,"y":380,"wires":[["1205e9dd8b9d22f9"]]},{"id":"8285dc624c35f5aa","type":"change","z":"4c90073d297b222d","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"export","tot":"str"},{"t":"set","p":"totals","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"totals.day_cost","pt":"msg","to":"day","tot":"flow"},{"t":"set","p":"totals.offpeak_cost","pt":"msg","to":"offpeak","tot":"flow"},{"t":"set","p":"totals.peak_cost","pt":"msg","to":"peak","tot":"flow"},{"t":"set","p":"totals.export_kwh","pt":"msg","to":"export","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":2300,"y":620,"wires":[["887faf743172e5fd"]]}]

Flow Info

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

Owner

Actions

Rate:

Node Types

Core
  • change (x14)
  • debug (x2)
  • function (x2)
  • http request (x2)
  • inject (x1)
  • join (x2)
  • split (x2)
  • switch (x2)
  • template (x2)

Tags

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