Community
OpenEnergyMonitor

Community

Need to reset kWh manually every two months

Tags: #<Tag:0x00007f6e0ee2bd68> #<Tag:0x00007f6e0ee2bbd8>

Hi, I read the relative threads and I couldn’t find a solution to my question, I hope you can help me.

My power utility company bills me every other month so I would like to reset KWh for each phase every two months, I don’t mind if I do this manually. Is this doable?

I run local emoncms with “low write 9.7.9” version on a raspberry Pi, it is a 3 phase system and my feeds are constructed as follows:

inside each feed is made like this:

if I run ls /boot | grep emonSD
Version is emonSD-07Nov16

Thanks a lot in advance

Patricio

Hello @Patricio, there’s no feature to reset a feed at particular intervals in emoncms Im afraid. Is your wish to see the cumulative kwh in the present 2 month period in a dashboard?

Hi Trystan
Yes that would be helpful, at least to compare measurements with the power utility

Thanks!

I’m not quite at the stage of trying this, but would this topic post work? Set up cron, scheduled task every two months?

Seems like it should … an interesting way to make events happen.

So, I have been able to create a cron job that submits a call to an input. That input then zero’s out my 3 feeds. I haven’t tested it extensively, but it seems to work.

Here is the cron job I have set up. It outputs a message that cron then emails to me. It’s a bit unnecessary but it’s only once a month:
0 0 27 * * if [[ $(/usr/bin/curl --data "node=cron&data={flag:2}&apikey=XXXb5b4e358bd451001095" "http://10.92.68.198/emoncms/input/post" -s -o /dev/null) -eq 0 ]] ; then echo "emoncms reset successful"; else echo "emoncms reset failed"; fi

This is the input processing I have for the feeds:

Hi Montgomeryb. Thanks for this solution! This will work. Did you created the cron process manually or in the Emoncms page?
Regards

`Hello,
I used the regular linux crontab to run this - I’m not sure that the gui has a cron page. I am running this locally in case the hosted version is different. Also, of course the cron job doesn’t have to be on the same machine, although it might be convenient.

I actually had to make some minor changes to the entry. The latest version is below. This will now notify me if curl fails, or if curl gets an error code from emoncms. It also emails me when it is successful, and I also have an email when emoncms processes the input - so I may remove the successful email from cron later. I’m pretty sure there are tricks with cron that you can set it to run every other month - google will help with that. If you wanted, I’m sure you could use windows task scheduler if that was easier.

0 0 13 * * /usr/bin/curl -f --data "node=cron&data={flag:1}&apikey=9405e32f8505fb5b4e358bd451001095" "http://10.192.168.198/emoncms/input/post" -s -o /dev/null; if [ $? -ne 0 ] ; then echo "emoncms reset failed"; else echo "emoncms reset successful"; fi

`