emonPI polling vs log frequency

Is it possible to configure the emonPI so that it refreshes the power consumption in near real time (say every 1 or 2 seconds), but updates the log less frequently (say every 10 seconds)?

I need the near-real-time power consumption for API client reasons, but do not want to overload the SD card unnecessarily.

Yes and no! ( You can’t beat a nice clear answer can you :slight_smile: )

Essentially if you use a PHPfina (fixed interval) feed set at say 10 secs and post data at 1 sec intervals what happens is, at every post the input processing runs and effectively because 10s hasn’t elapsed since the last FEED update the value will not get persisted, so this does exactly as you ask. But it also means that the non-persisted data is just ignored, not averaged or summed between feed updates, so for example in the case of a load that is cycling 1kW for 9secs and 0kW for 1sec, you would in theory have a 10% chance of reporting a constant 0kW (in reality the 10s cycle and the 10s fixed interval feed would never align perfectly for any duration) or a 90% chance of reporting a constant 1kW depending on how “synced” those cycles were, so the accuracy of the recorded data could be seriously reduced.

I think you could also hit problems with the data passing though emonHub as the current “emonPi” variant has a bug that causes threads to crash intermittently and the frequency of those fails has also been linked to the posting frequency. If it’s essential you do post at that rate you may want to look at the original version of emonhub which does not suffer this issue and can post data much faster.

The emonSD uses a buffered write process and the frequency of the datapoints should not affect the SDcard life directly as the data is written to disk every 60s regardless, although the increased frequency will of course increase the feed size on disk so a larger SDcard would be recommended

Thanks Paul for the heads-up, very helpful as I am totally new to anything emon. Just ordered the emonPI.

I conclude that I should set an identical frequency for the CT sensor and the writing of the log for accurate reporting. That’s okay.

I will not have an emonHub. Instead I am planning to have a Windows 10 client requesting the amperage from the emonPI via API at the same API frequency as the CT sensor and log writing, to get a near-real-time amperage in a WIndows application. This should avoid the bug you are referring to, right? I hope this is possible and I am not missing anything here.