Logging data from Profilux (3) out to another device

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)

Macca_75

Active Member
View Badges
Joined
Jan 31, 2019
Messages
369
Reaction score
166
Rating - 0%
0   0   0
I had a Raspberry Pi lying around from another project and decided to have a go at pulling data from the Profilux and recording it into a database to keep longer history, etc.

In a nutshell this involved the Raspberry PI, free software Grafana and InfluxDB and a few days of playing around.

I created some custom pages for the Profilux 3 to make use of the tokens (I've used what I can, but there are some items I can't find the tokens for such as digital input, etc).

This is what I have thrown together for a dashboard to play with the different elements, styles, etc. It will be more refined as I figure out what I want to see and how I want it displayed.

1640227037553.png


I basically use 1 bash script to pull the data from the Profilux, manipulate it on the PI and store it to InfluxDB, then have Grafana present it (from the same PI). I've port forwarded the PI on the Grafana port so it's accessible from the internet.

All in all, a very easy DIY project, I can chose how long to keep the data, its far more responsive that other methods of getting the data and very customisable. All scripts are dynamic in terms of the number of sensors, switches/sockets, dosers, etc - the more you have the more it logs.

Next up will be trying to make interactive buttons (so I can activate Feed Timers, Maint Mode, etc).

Oh - and maybe an interface so I can log my test results against a point in time.
 
OP
OP
M

Macca_75

Active Member
View Badges
Joined
Jan 31, 2019
Messages
369
Reaction score
166
Rating - 0%
0   0   0
Interesting! How are you pulling the data?
Sorry for the delayed reply - holiday season and all.

It's pretty easy - I made custom files and uploaded to the P3 - the files use tokens. Here is the code for one of the files (Sensors). It has a .JSON extension as I started with JSON data but through reading/trial and error I switched to using line protocol for InfluxDB. Sloppy - but I just kept the same file names (so the payload is NOT JSON)

Anyway, the contents of "sensordata.json" is
Code:
$$REPS[32][0]$$$$SENN[x]$$,$$SEND[x]$$,$$SENV[x]$$,$$SENO[x]$$,$$SENR[x]$$,$$SENF[x]$$,$$SENX[x]$$
$$REPE$$

When you addess the file using a URL - http://<myhost.mydomain.com/sensordata.json you get the following lines returned

Code:
pH-value 1,pH probe,   7.76pH,+ ,4.500...9.500,2:2:pH,   8.10pH
Temperature 1,Temperature,    25.5C,  ,1.000...36.000,2:1:C,    25.3C
Redox 1,ORP,    412mV,- ,-300.000...600.000,3:0:mV,    200mV
Voltage 1,Voltage_in_1,    0.00V,+ ,0.000...10.000,2:2:V,    5.00V
Voltage 2,Voltage_in_2,    0.00V,+ ,0.000...10.000,2:2:V,    5.00V

I then created a script on the Raspberry PI that

1) Deletes a temp txt file.
2) uses CURL to pull the contents of sensordata.json into a txt file
3) Reads the .txt file into an array
4) Does some fooling around with each element of the array
5) writes the array into a (new) copy of the file deleted in step 1
6) uses InfluxDB line protocol to write the data into the DB

In answer to your question the script above runs every minute using cron on the PI - o every minute data is pulled and stored into the DB

If you want some more sample code let me know and I can PM you the files.
 

MaddyP

'Til Reefdom Come...
View Badges
Joined
Jul 21, 2016
Messages
1,907
Reaction score
4,530
Location
Vancouver, WA
Rating - 0%
0   0   0
Sorry for the delayed reply - holiday season and all.

It's pretty easy - I made custom files and uploaded to the P3 - the files use tokens. Here is the code for one of the files (Sensors). It has a .JSON extension as I started with JSON data but through reading/trial and error I switched to using line protocol for InfluxDB. Sloppy - but I just kept the same file names (so the payload is NOT JSON)

Anyway, the contents of "sensordata.json" is
Code:
$$REPS[32][0]$$$$SENN[x]$$,$$SEND[x]$$,$$SENV[x]$$,$$SENO[x]$$,$$SENR[x]$$,$$SENF[x]$$,$$SENX[x]$$
$$REPE$$

When you addess the file using a URL - http://<myhost.mydomain.com/sensordata.json you get the following lines returned

Code:
pH-value 1,pH probe,   7.76pH,+ ,4.500...9.500,2:2:pH,   8.10pH
Temperature 1,Temperature,    25.5C,  ,1.000...36.000,2:1:C,    25.3C
Redox 1,ORP,    412mV,- ,-300.000...600.000,3:0:mV,    200mV
Voltage 1,Voltage_in_1,    0.00V,+ ,0.000...10.000,2:2:V,    5.00V
Voltage 2,Voltage_in_2,    0.00V,+ ,0.000...10.000,2:2:V,    5.00V

I then created a script on the Raspberry PI that

1) Deletes a temp txt file.
2) uses CURL to pull the contents of sensordata.json into a txt file
3) Reads the .txt file into an array
4) Does some fooling around with each element of the array
5) writes the array into a (new) copy of the file deleted in step 1
6) uses InfluxDB line protocol to write the data into the DB

In answer to your question the script above runs every minute using cron on the PI - o every minute data is pulled and stored into the DB

If you want some more sample code let me know and I can PM you the files.
Nicely done! I'll keep this in mind for the future. :)
 

tk9

New Member
View Badges
Joined
Jul 14, 2023
Messages
1
Reaction score
0
Location
eersel
Rating - 0%
0   0   0
To add to this old thread, here is what a dutch guy made for me.
It is a way to extract data from profilux to influxdb with help function.
its on GitHub https://github.com/brandjas/Profilux-InfluxDB
you can adapt it to different sensors or platforms. Mine is Pi
In the recent influxDB is a web interface, so you could do without Grafana.
Worth a try


Screenshot 2023-07-14 at 13.30.56.png
 
Back
Top