InfluxDB, Grafana, Node-red to monitor a Profilux on Raspberry Pi

Macca_75

Active Member
View Badges
Joined
Jan 31, 2019
Messages
369
Reaction score
166
Rating - 0%
0   0   0
If the subject line hasn’t lost you hopefully you can help me out

Forgive the babble below, I am an “enthusiast” at best and probably am not using the correct terms.

AIM:

Setup a Raspberry Pi to poll my Profilux (say every minute) and store the data and present it in a more customisable, user-friendly manner that GHL offer.

HOW:

To this end I have created a JSON file (output below, but I can modify it once I understand exactly what I need).

I am polling the following from Profilux (using TOKENS) and grouping data into the 6 types I want to store: Sensors, Illumination, Switches, LevelSensors, 1-10V and Dosing.

Each object in the same type returns the same data sets however different types will return different elements: (eg.)

  • All sensors (I have 5) will return Description, CurrentVal, Control, NominalValue, Limits, Name, Format
  • All Dosing Pumps (I have 16 active) will return Name, Description, FillLevel, DaysLeft, AlarmThreashold, Capacity
And so forth

I am having an issue getting my head around the InfluxDB database structure. Would I be right in understanding I want 1 database (lets name it AQUARIUM).

What’s the equivalent in influxDB to a table for SQL? I assume I want 6 of these (1 for each type)

Each “table” would have different fields based on the elements for each

  • “Sensors” table would have timestamp + 7 – so 8 columns in total. And each write to the DB would create 5 rows in this table
  • “Dosing” table would have timestamp + 6 – so 7 columns in total. And each write to the DB would create 16 rows


Is this how the structure of InfluxDB works?

Here is a copy of my JSON output
{ "sensors": [ { "Description":"pH probe", "CurrentVal":" 7.82pH", "Control":"+ ", "NominalValue":" 8.10pH", "Limits":"4.500...9.500", "Name":"pH-value 1", "Format":"2:2:pH" }, { "Description":"Temperature", "CurrentVal":" 25.3C", "Control":" ", "NominalValue":" 25.3C", "Limits":"1.000...36.000", "Name":"Temperature 1", "Format":"2:1:C" }, { "Description":"ORP", "CurrentVal":" 443mV", "Control":"- ", "NominalValue":" 200mV", "Limits":"-300.000...600.000", "Name":"Redox 1", "Format":"3:0:mV" }, { "Description":"Voltage_in_1", "CurrentVal":" 0.00V", "Control":"+ ", "NominalValue":" 5.00V", "Limits":"0.000...10.000", "Name":"Voltage 1", "Format":"2:2:V" }, { "Description":"Voltage_in_2", "CurrentVal":" 0.00V", "Control":"+ ", "NominalValue":" 5.00V", "Limits":"0.000...10.000", "Name":"Voltage 2", "Format":"2:2:V" }, ], "Illumination": [ { "Name":"Illumina. 1", "Description":"Blue", "Value":"100%", "Color":"16767491" }, { "Name":"Illumina. 2", "Description":"Royal Blue", "Value":"100%", "Color":"16744196" }, { "Name":"Illumina. 3", "Description":"White", "Value":" 30%", "Color":"11534013" }, { "Name":"Illumina. 4", "Description":"Red", "Value":" 10%", "Color":"32255" }, { "Name":"Illumina. 5", "Description":"Green", "Value":" 69%", "Color":"1245043" }, { "Name":"Illumina. 6", "Description":"Hyper Red", "Value":" 33%", "Color":"70399" }, { "Name":"Illumina. 7", "Description":"Yellow", "Value":" 53%", "Color":"126975" }, { "Name":"Illumina. 8", "Description":"Warm White", "Value":" 67%", "Color":"7793919" }, { "Name":"Illumina. 9", "Description":"Hyper Violet", "Value":"100%", "Color":"16715110" }, ], "switches": [ { "Name":"S 5", "Description":"Lanthium", "State":"Off", "CurrentDraw":"0.0 A", "Function":"Dosing pump 1", "Used":"u", "Mode":"0" }, { "Name":"S 6", "Description":"Spare Dosing", "State":"Off", "CurrentDraw":"0.0 A", "Function":"Dosing pump 2", "Used":"u", "Mode":"0" }, { "Name":"S 7", "Description":"Spare Dosing", "State":"Off", "CurrentDraw":"0.0 A", "Function":"Dosing pump 3", "Used":"u", "Mode":"0" }, { "Name":"S 8", "Description":"Phytoblast", "State":"Off", "CurrentDraw":"0.0 A", "Function":"Dosing pump 4", "Used":"u", "Mode":"0" }, { "Name":"S 9", "Description":"00", "State":"Off", "CurrentDraw":"0.0 A", "Function":"Temperature 1 +", "Used":"u", "Mode":"0" }, { "Name":"S10", "Description":"Return", "State":"On ", "CurrentDraw":"0.0 A", "Function":"Always on", "Used":"u", "Mode":"0" }, { "Name":"S11", "Description":"Avast", "State":"Off", "CurrentDraw":"0.0 A", "Function":"Timer 2", "Used":"u", "Mode":"0" }, { "Name":"S12", "Description":"600W Heater", "State":"Off", "CurrentDraw":"0.0 A", "Function":"Temperature 1 ++", "Used":"u", "Mode":"0" }, { "Name":"S13", "Description":"WebCam", "State":"On ", "CurrentDraw":"0.0 A", "Function":"Always on", "Used":"u", "Mode":"0" }, { "Name":"S14", "Description":"Sulphur", "State":"On ", "CurrentDraw":"0.0 A", "Function":"Always on", "Used":"u", "Mode":"0" }, { "Name":"S15", "Description":"v1 Doser", "State":"On ", "CurrentDraw":"0.0 A", "Function":"Always on", "Used":"u", "Mode":"0" }, { "Name":"S16", "Description":"ehiem feeder 1", "State":"Off", "CurrentDraw":"0.0 A", "Function":"Programab.logic 3", "Used":"u", "Mode":"0" }, { "Name":"S17", "Description":"Skimmer", "State":"On ", "CurrentDraw":"0.0 A", "Function":"Programab.logic 4", "Used":"u", "Mode":"0" }, { "Name":"S18", "Description":"Mitras - white", "State":"On ", "CurrentDraw":"0.2 A", "Function":"Always on", "Used":"u", "Mode":"0" }, { "Name":"S19", "Description":"Mitras - Middle", "State":"On ", "CurrentDraw":"0.2 A", "Function":"Always on", "Used":"u", "Mode":"0" }, { "Name":"S20", "Description":"Mitras - black", "State":"On ", "CurrentDraw":"0.3 A", "Function":"Always on", "Used":"u", "Mode":"0" }, ], "LevelSensors": [ { "Name":"Level 1", "Value":"Off" }, { "Name":"Level 2", "Value":"On " }, ], "1-10V": [ { "Voltage":"5.52 V" }, { "Voltage":"0.80 V" }, { "Voltage":"4.74 V" }, { "Voltage":"3.68 V" }, { "Voltage":"2.30 V" }, { "Voltage":"10.00 V" }, ], "Dosing": [ { "Name":"Dosing pump 1", "Description":"PhytoMix", "FillLevel":"149", "DaysLeft":"104.8479611.1", "AlarmThreashold":"100", "Capacity":"800" }, { "Name":"Dosing pump 2", "Description":"Unused", "FillLevel":"0", "DaysLeft":"-1.0000001.1", "AlarmThreashold":"200", "Capacity":"30000" }, { "Name":"Dosing pump 3", "Description":"Unused", "FillLevel":"0", "DaysLeft":"-1.0000001.1", "AlarmThreashold":"50", "Capacity":"500" }, { "Name":"Dosing pump 4", "Description":"Lanth", "FillLevel":"43", "DaysLeft":"7.3161411.1", "AlarmThreashold":"100", "Capacity":"1000" }, { "Name":"Dosing pump 5", "Description":"Alk", "FillLevel":"4883", "DaysLeft":"30.5240061.1", "AlarmThreashold":"200", "Capacity":"10000" }, { "Name":"Dosing pump 6", "Description":"Mg", "FillLevel":"1872", "DaysLeft":"24.9647871.1", "AlarmThreashold":"200", "Capacity":"4000" }, { "Name":"Dosing pump 7", "Description":"Calcium", "FillLevel":"4063", "DaysLeft":"21.1652641.1", "AlarmThreashold":"200", "Capacity":"10000" }, { "Name":"Dosing pump 8", "Description":"Vinegar", "FillLevel":"1517", "DaysLeft":"101.1559911.1", "AlarmThreashold":"200", "Capacity":"2000" }, { "Name":"Dosing pump 9", "Description":"", "FillLevel":"0", "DaysLeft":"-1.0000001.1", "AlarmThreashold":"100", "Capacity":"0" }, { "Name":"Dosing pump10", "Description":"", "FillLevel":"0", "DaysLeft":"-1.0000001.1", "AlarmThreashold":"100", "Capacity":"0" }, { "Name":"Dosing pump11", "Description":"", "FillLevel":"0", "DaysLeft":"-1.0000001.1", "AlarmThreashold":"200", "Capacity":"1000" }, { "Name":"Dosing pump12", "Description":"", "FillLevel":"0", "DaysLeft":"-1.0000001.1", "AlarmThreashold":"200", "Capacity":"1000" }, { "Name":"Dosing pump13", "Description":"", "FillLevel":"0", "DaysLeft":"-1.0000001.1", "AlarmThreashold":"200", "Capacity":"1000" }, { "Name":"Dosing pump14", "Description":"", "FillLevel":"0", "DaysLeft":"-1.0000001.1", "AlarmThreashold":"200", "Capacity":"1000" }, { "Name":"Dosing pump15", "Description":"Heater", "FillLevel":"354", "DaysLeft":"-1.0000001.1", "AlarmThreashold":"9000", "Capacity":"9000" }, { "Name":"Dosing pump16", "Description":"NSW Storage", "FillLevel":"398", "DaysLeft":"26.5794681.1", "AlarmThreashold":"100", "Capacity":"2000" }, ] }
 

SPR1968

No, it wasn’t expensive dear....
View Badges
Joined
Feb 21, 2017
Messages
20,028
Reaction score
124,588
Location
Nottinghamshire England
Rating - 0%
0   0   0
I can’t help with the specific question but I can bump the thread to see if we can get you some attention
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,825
Reaction score
17,041
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
It’s been long since I have used influx , but are you hitting any specific issue ? If you have the error type , we can help from there.
i use Prometheus now . I didn’t know profilux provides an api . That very nice of them .
 

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
I’m using InfluxDB for my Node-RED controller.

It sounds like you need one bucket (database) with 6 different measures (tables). A measure can be made up of multiple tags and fields (like columns), the difference being tags are indexed and fields are not.
 
OP
OP
M

Macca_75

Active Member
View Badges
Joined
Jan 31, 2019
Messages
369
Reaction score
166
Rating - 0%
0   0   0
Thanks Guys. With a bit of mucking around I managed to create a script that polls some files on The Profilux. It dynamically adjusts to the number of returns (ie, if you add another powerboard it will start collecting for them)

So far it looks like this (I need to prune the firt 10 mins out - I powered the Profilux down by mistake (knocked the power adaptor) - so on restart all the probes were a little out)

1640486996718.png


Still playing with the data but so far it is collecting the sockets, sensors, dosing heads, lights, level sensors and 1-10v ports. I'll add alarms and potentially an interface to activate feed and maint modes later are the silly seasons holidays.
 

benkrebs

New Member
View Badges
Joined
Feb 16, 2020
Messages
8
Reaction score
2
Rating - 0%
0   0   0
Hey @Macca_75 ,
thanks for sharing!
Could you please give me a hint how you scrape the data?
I own Profilux 4 and there is too much JavaScript in the website for me ;-)

- is there an API now?
- how/where can I access JSON files?
- is there any chance to write a value (like power on/off) ?

Thanks and all the best,
Ben
 
OP
OP
M

Macca_75

Active Member
View Badges
Joined
Jan 31, 2019
Messages
369
Reaction score
166
Rating - 0%
0   0   0
Hey @Macca_75 ,
thanks for sharing!
Could you please give me a hint how you scrape the data?
I own Profilux 4 and there is too much JavaScript in the website for me ;-)

- is there an API now?
- how/where can I access JSON files?
- is there any chance to write a value (like power on/off) ?

Thanks and all the best,
Ben
Can you write custom files to the P4? If so I can share the files but if not.....

The JSON files are custom written (I started with JSON however the payload is no longer JSON as it's faster using line protocol). Anyway - I can provide the file if you can confirm you can upload to a Profilux 4 and address the Profilux using a web browser.

Pulling the data - you need to write a pull to the Profilux that uses tokens to "return" the data - then I use a script on the PI to pull the data. The script is run using cron every minute.

And yes you should be able to "write" a value to the P4 using Javascript
 

benkrebs

New Member
View Badges
Joined
Feb 16, 2020
Messages
8
Reaction score
2
Rating - 0%
0   0   0
Thanks! I guess I can not write files to PL4 anymore..
Folks from GHL just replied:

- no API existing; might be "next" project and is planned
- use e-mail for data export

All the best, Ben
 

Badboy GP

Community Member
View Badges
Joined
Apr 3, 2020
Messages
46
Reaction score
76
Rating - 0%
0   0   0
Just wow...

I need this.
Unless I have to have a PI running the ghl app displayed on a screen.

I have a profilux 3.1ex I think... can you help me, this all looks foreign to me.
 
OP
OP
M

Macca_75

Active Member
View Badges
Joined
Jan 31, 2019
Messages
369
Reaction score
166
Rating - 0%
0   0   0
Just wow...

I need this.
Unless I have to have a PI running the ghl app displayed on a screen.

I have a profilux 3.1ex I think... can you help me, this all looks foreign to me.
Easy as - Do you have a Raspberry PI floating around? If not grab a 3B+, 4 or higher (don't really need a lot of compute). Best to grab a 32Gb SD Card. Then we can make a start. I'll try and write a how to for you once you have the PI
 

jasperb75

New Member
View Badges
Joined
Mar 14, 2024
Messages
1
Reaction score
0
Location
The Netherlands
Rating - 0%
0   0   0
Easy as - Do you have a Raspberry PI floating around? If not grab a 3B+, 4 or higher (don't really need a lot of compute). Best to grab a 32Gb SD Card. Then we can make a start. I'll try and write a how to for you once you have the PI
Hi Macca_75,
This looks very nice. Do you have a how to how to manage and read status of a Profilux 3 via Raspberry PI with Node Red? I haven't found any resources yet.
Thanks, Jasper
 
Back
Top