emoncms / app

Emoncms App module: application specific dashboards: includes myelectric, mysolarpv, myheatpump and solar + wind app.
GNU Affero General Public License v3.0
28 stars 70 forks source link

Instantaneous power cost #155

Open bwduncan opened 3 years ago

bwduncan commented 3 years ago

I have just switched to Octopus, looking forward to a smart meter and switching to agile. This means I've been spending a lot more time staring at the agile app :smile: I noticed that a couple of things weren't quite right: The graph never updates unless you press a button, and the "Import now" display showed power even if you clicked the "Cost" button. I think this was the intention, from looking at the code. This PR fixes both of these things, and removes some cruft.

I've tested this on my emonpi and it works well. More testing would be welcome, though.

I have solar PV but I'm not signing up to the Octopus export tariff. This means that the app will show nonsense when I am exporting. This could be fixed for myself by adding a fixed export price config option, and I think it would be trivial to make it work for Octopus export, too. If I get the time later I may add to this PR. Any feedback on whether allowing the flexibility in the app to do solar but without Octopus's FIT would be welcome.

Please pull!

bwduncan commented 3 years ago

I've been running this for a few days and I've noticed that it puts an immense load on the browser, and probably the server too.

Reloading the agile, outgoing and carbonintensity feeds every 5s is excessive, the first two only change once a day! I've now moved those out into a separate function and I'm testing it.

TrystanLea commented 3 years ago

Thanks @bwduncan this is a good option to include.

It looks like the currency is only being applied to the end result, I wonder if actually modifying the outgoing data array to be a fixed amount would be a better approach? Here's part of a suggestion:

https://github.com/emoncms/app/compare/fixed_export?expand=1

bwduncan commented 3 years ago

Hi Trystan,

Thanks for replying, I really appreciate your feedback :smile:

That looks like exactly the sort of thing I had in mind. I've patched my local copy and I will run with it for a few days to see if it does the job. The first thing I noticed is that it adds VAT :laughing: but apart from that it works exactly as I expected.

I actually made another minor change here to do with showing the currency. Because a cost per hour is almost always less than a pound, I didn't like looking at £0.0015/hr, much nicer to read 0.15p/hr instead. I'll push that commit in a bit. Since this app is only really useful with Octopus, therefore probably only in the UK, I'm not sure if it makes sense to allow users to change the units. I left it in anyway, since Octopus is in the US at least it's probably only a matter of time...

Bruce

bwduncan commented 3 years ago

I've realised that what I get is a generation tariff, not export. Is a fixed export tariff useful to anyone?

TrystanLea commented 3 years ago

Thanks @bwduncan, do Octopus provide a fixed export tariff or is it just Outgoing or a generation tariff?

bwduncan commented 3 years ago

Hi @TrystanLea ,

I looked into this a bit and realised the I'm getting a bum deal off British Gas. Who is surprised?

I should not have been surprised that generation and export tariffs are treated separately. I had assumed that you have to get both from the same FIT licensee. Tomorrow I will phone BG and ask if I can opt out of the export part, but keep the reasonably generous generation tariff. I'm getting 3.9p/kWh on 50% deemed export. I think I can do better on octopus.

As for the export tariff, it looks like Octopus offer a fixed (5.5p/kWh) and an agile tariff, which this app already supports. I think those two are sufficient for the scope of this app. While it might be cute to also have a generation tariff, it's not really necessary.

https://octopus.energy/blog/outgoing/

I've been a bit busy lately but I'll see if I can conjure another commit this week.

Thanks :smile: Bruce

TrystanLea commented 3 years ago

Good to hear thanks @bwduncan !