Calculating cost as a feed

Hi, I’m new here and have everything setup and working, I’m using Emoncms with Home Assistant and I am looking for a way to calculate cost in a feed or via a ‘Post Process’, if this possible?

I have searched and not found a definite answer.

Also I’m still confused as to whether I should be using Real Power or Apparent Power, I sort of understand the difference between the two but confused how to calculate the overall cost of electricity throughout the day.

Any help will be appreciated

Thank you

Welcome, Denver, to OEM.

The quick and simple answer is, real power is the one you get charged for, as a domestic consumer.

If you’re an industrial consumer, you may well be penalised if your apparent power is too high (because it costs the supplier in system capacity for which they can’t normally charge).

I’m afraid I can’t help with the software question.

Thanks for clarifying the real or apparent power confusion.

I have just created a Post Process to calculate the kWh from real power, which I imagine is now showing total kWh since I started using Emoncms which is about a year ago, so showing 2370kWh unless I’m mistaken.

How can I add the calculation to show the cost in the feed, or is that not possible.

If you have a flat rate tariff, this should be achievable by using a process to calibrate the kWh and multiply by the rate. Then create a new feed from this with currency as the unit.

If you have day/night rate this may need a schedule linked in somehow, but not sure how you would do that.

There are a couple of Apps available (from the “Apps” section of the EmonCMS UI) that will calculate cost from a kWh feed. Had you already looked at those?

They don’t create a feed, but they are useful for cost calculations :slight_smile:

Thanks, I had looked at the app’s but was wanting to create a feed really. May look at calculating the cost in Home Assistant if it cant be created in Emoncms.

What a good idea! Following with interest.

Also, not to highjack, am really struggling to get any data in to HA, after adding the required lines to config.yaml. Could you tell me what you did after updating the config to get some data on to the Lovelace cards?


I think I got this sorted by making a virtual feed:

I’m multiplying the power source by 0.0001567, which is my tariff cost (15.67 per kWH) divided by 100,000 so it is cost per watt. Seems to reflect the same as the My Electric App.

Now just to get the info over to Home Assistant! Any pointers on that front?


Off topic but in HA, go to Developer Tools > STATES > Filter entities and type in ‘emoncms’ without quotes and all feeds will be listed.

1 Like

Got it sorted last night, hadn’t understood that there can only be one ‘sensor’ entry in config.yaml, to be honest though, just displaying the My Electric App in an iframe presently