PHPFINA value drop to zero

Ok, so typically the incoming 10s data is power in watts and the power to kwh process is used to post to a 10s phpfina feed, that sounds fine. I just wanted to check there was nothing odd in the way the data arrived.

This isn’t something I’ve experienced so I’m not sure how much I can help, especially as I have never run emoncms on Ubuntu either.

When new input data arrives the power to kwh process takes the last datapoint from the feed and uses that time and value pair to establish the time interval between this and the last datapoint, if that time interval is less than 2hrs it updates as usual, by calculating the energy over that time interval from the power and adding it to the last value, or if the interval is over 2hrs, it will fallback to using the last value without any adjustment for this updated input to avoid any spikes caused by absent inputs.

So in those instances you should have seen either uninterrupted data or at worse, a flat where the same value was reused. For it to drop to “zero” that would mean the last value was not accessible at the time and the last time and value have been assumed to be zero’s. Then the above code would determine the time interval to be over 2hrs (now - 0 = >2hrs) and reuse the last value, (assumed to be zero).

Why the last values were un-available at that time I can only speculate, but do you use redis? if you do not then I cannot think why this should happen if you migrated your data, obviously permission wasn’t an issue as it has written to the db.

Did you have the Redis settings in emoncms/settings.php set correctly before first use?

If you are using Redis, Was the Redis server running before the apache2 server came on-line? Did you have the phpredis PHP extension enabled? Did you flush Redis?

A change from Ubuntu 15.10 to 16.04 usually involves a change from php 5.6 to 7.0, so the phpredis extension could need changing as well, depending on what version you were previously running.<=2.2.8 won’t work with php7.0.

Sorry I can’t be of more help. I would be good to find out the reason this happened to try and avoid it happening again, but I do not think we can rectify your data by finding the issue.

The only way to fix your data is to find someway of manually adding the last good value to every single subsequent value, there is no mechanism to do this within emoncms that I’m aware of, so you would need to edit the phpfina files offline and directly by writing a custom script, there are some scripts you could look at for ideas in the emoncms/useful_scripts github repo though.