Reset accumulator feed at midnight via API?

Hi Daniel

Assuming this to be on the same setup you discuss on the [How to get correct kWh/W values from Pulse]
(How to get correct kWh/W values from Pulse - #18 by danielpugh) thread it would be easy to zero one or more feeds at midnight using cron, but you wouldn’t need to use any API calls.

Ad another line to the crontab

00 0 * * * /bin/bash -c 'echo -e "99 0\r" > /dev/tcp/localhost/50011'

(I’ve used node id 99 in the example but you can use any currently unused node id)

As you already have a [[cron]] socketinterfacer setup, if you run

printf "99 0\n" > /dev/tcp/localhost/50011

from the command line (assuming node 99 again) you should get a new input created in emoncms. In that new inputs processing just add
log to feed “feed1”
log to feed “feed2”
etc etc where feed1 and feed2 are the pre-existing feeds to be zeroed.

However this will not work reliably with fixed interval feeds if there is any chance of your regular inputs and processing changing any “zeroed” feeds before it is saved on it’s next occurrence of the interval. So best to avoid phpfina for these feeds.

All being well, at midnight the cron job will run sending a single zero to node 99 in emoncms via emonhub causing the processing to run and set all the defined feeds to zero regardless of whats happening in any parallel input processing for the same feeds.