Generate monthly electrical usage bill

I have purchased an emonpi, running emoncms locally, and configured it to read from 2 CTW connectors. I have successfully configured the mobile app to give me readings of usage. I am looking for a way to export monthly usage as a bill.

As of now I believe I can only look at the data through the web interface, the mobile app, make API requests, or export to a CVS file.

Does anyone know of any scripts written to use the API to generate a PDF bill?

Hello @jasenmichael the easiest way to do this is using the emoncms graph module, see the user guide here Emoncms Graphs - Guide | OpenEnergyMonitor

Here’s an example showing monthly kWh from a cumulative kWh feed:

Select ‘Monthly’ under type and zoom out to the period of time that you wish to fetch the output over.

If you are using a cumulative kWh feed you need to put a tick in the Delta property to provide monthly totals, otherwise for say average temperature, select average.

The CSV output is available below.

1 Like

Thank you for the feedback, but your solution describes what I have done. I am looking for a known way to export monthly bill(that show kwh used, and the total cost for the month; based on cost per kwh) to pdf.

Maybe I need to:
1: write something in node or python, that uses the emoncms rest api via http requests; to get the “kwh used in a date time range”
2: do the math based on my cost per kwh to get “monthly cost”
3: create a html web-interface that uses a javascript pdf library to generate a pdf - that displays the “kwh used in a date time range” and “monthly cost”

I will look into the emoncms api, in the meantime if anyone has any feedback on any widgets or scripts(similar to the android app) that can export monthly bill to pdf.

Ah sorry. A useful shortcut to working out the required API request is to configure the graph module view as above and then use the network tab in developer tools to see the underlying request made. You can then copy this and use it in your script with modifications to provide the right parameter values

1 Like

Excellent advice, gotta love the dev tools. I plan to build and share a simple export monthly bill to pdf script, this can all be done in the browser.

1 Like

Might be worth exposing that as a button to copy it to clipboard @TrystanLea @emrys.

1 Like

Sounds great! thanks!