Myelectric2 pricing x1000 out

Just a minor issue, I started using the myelectric2 app today but I noticed on the detailed/zoomed view, the pricing is x1000 the actual price:

I had a quick look at the code and there seems to be a mix up between W and kW.

I’ve proposed a fix here Fix pricing for myelectric2 when using W rather than kWh by langers2k · Pull Request #152 · emoncms/app · GitHub although there are probably better ways.

Are you sure it isn’t your Feeds that are incorrect? :grin:

Can you post images of the app configuration you are using?

Yup, pretty sure my feeds are correct.

Config is as follows:

As you can see, the price per kWh is £0.16999 per kWh so 466 W (0.466 kWh) should be 7.8p not £78.20. In the bottom left of the first image, it shows the entire energy shown on the graph is 7.8 kWh and costs £1.22, both of which are correct. Only the tooltip is incorrect.

You can see in the code where the mistake is. For the tooltip it will either show W or kW depending on usage, but both values are multiplied by the same kWh rate. As you’d expect, this is causing W price to be 1000x out :slight_smile:

Code in question is here:

Yes, looks like it. Good find.

Thanks @langers2k, good find!

I think perhaps it’s better to hide the cost all together in the power view? Because the units are in Watts and the interval between data periods change as you zoom in and out the cost for a particular interval would need to take this into account. The cost of the view is shown below the graph, perhaps that is enough?

I’ve made a modification to this effect:
hide cost in power mode · emoncms/app@2d51198 · GitHub

1 Like

Yup, that makes sense as the cost would only be valid if the usage remained constant for an hour :slight_smile:

Thanks!

1 Like