From PHPFina to CSV?

Hi everybody,

I have questions regarding data saving format : there is something I do not seem to grasp.
I have an emonBase and three emonTh and I currently log every temperature using the PHPFina engine :
Is there a way to automatically produce CSV files of the logged feeds ? Or better yet, is it possible to convert fina generated files to .csv ?

I could use node-RED but it seems an heavy implementation and a quite redundant one.

Something is bothering me because I had the feeling that this was a simple task and that I should not be alone with this use case, still I have not found any detailed answer on the subject.
Moreover it feels like everything is already implemented : from the interface I can manually export a .csv file containing all inputs of a feed. Would it be possible to automate this ?

Any thought, advice or recommendation on the subject ?

Thanks guys, have a nice day.

Kevin -

There is not a automated CSV export that I know of. But you might be able to create one with this info:

or maybe this:

Thank you for the provided answer.

I am quite unfamiliar with PHP : do you have any idea of what would be the best approach to use this PHP program and where should I use it ?
In the mean time I will dig some PHP documentation but if you already have further insights to provide and some time to spare for my question, it would be really helpful.

Thanks again

Hi Kevin - I can give you instructions as they apply to an emonPi. Would that help?

I donā€™t own an emonbase and Iā€™m not sure I understand the differences. And I am just learning PHP also. Hopefully someone else more proficient can help also!

Keep in mind the CSV created will be stored on the emonbase.

Hi Jon,

An emonPi is essentially a RasPi 3 paired with a cut-down emonTx and a digital display.
An emonBase is a RasPi paired with an optional UHF RF module.

The emonPiā€™s internal ā€œemonTxā€ has only two inputs vice the four inputs on a ā€œstandaloneā€ emonTx.

does it use the same emonSD image?

Yes, for the purpose of this topic there is no difference, only the user values, feeds and processing etc will be different, the structure, SW versions etc should all be the same.

Kevin,

Here is a step-by-step guide to use this PHP program:

  1. Copy the php program to the /home/pi/data directory of the emonbase.

  2. Pick a phpfina test feed and take note of the Feed ID number. Try running the PHP progrmam by entering the following command for Feed ID 1:

php /home/pi/data/export_phpfina_feed_to_csv_v4.php 1

  1. If all works as expected, it will create the file:

/home/pi/data/feed_1.csv

FYI - a 2MB phpfina .dat file will become a 12 to 16 MB csv file and will take about 28 seconds to convert to csv.

1 Like

Great, it works like a charm, thanks !