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
Review score
+0 /0 /-0
View Badges
Joined
Jan 31, 2019
Messages
322
Reaction score
148
Review score
+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
M

Macca_75

Active Member
Review score
+0 /0 /-0
View Badges
Joined
Jan 31, 2019
Messages
322
Reaction score
148
Review score
+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...
Review score
+0 /0 /-0
View Badges
Joined
Jul 21, 2016
Messages
1,891
Reaction score
4,496
Review score
+0 /0 /-0
Location
Portland, OR
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. :)
 

Is there such a thing as an "easy" acro?

  • YES (tell us about it in the thread)

    Votes: 83 44.4%
  • NO

    Votes: 43 23.0%
  • Not sure

    Votes: 59 31.6%
  • Other (please explain)

    Votes: 2 1.1%
Top Shelf Aquatics
Top