Help with flow meter Stopped working.

Sral

Active Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
238
Reaction score
262
Review score
+0 /0 /-0
Location
Germany
All but deleted data files I don’t know how to do what you are asking to do. I don’t know how to navigate or the commands. The software part i don’t know.
Right, it's exactly like explained in this post where you modify the config.txt.

first, stop the Flowmeter service that's accessing these files, if you haven't already:
sudo systemctl stop flowmeters.service

Then edit the data files, you just have to put in the correct path:
sudo nano /var/lib/reef-pi/flowmeters/totalFlowS_0.txt
sudo nano /var/lib/reef-pi/flowmeters/totalFlow_0.txt


Make a screenshot of the contents for us and then edit it to '0.0' (no quotation marks).

Then press CTRL + S on keyboard to save and CTRL + Z to exit.

Then you can test again with the commands robsworld gave you:
cd /var/lib/reef-pi/flowmeters/

./flowmeters

If that works, restart the service:
sudo systemctl start flowmeters.service

If not, I will give you the commands for deletion ^^
 
Reef Chasers Aquaculture

robsworld78

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
Feb 14, 2020
Messages
835
Reaction score
1,116
Review score
+0 /0 /-0
Location
Edmonton, Canada
Did you do what I said or what @robsworld78 said ? ^^
Also: did you try deleting the data files ?

I expected @robsworld78's new scripts not to work, since the script always reads the file first, before saving the new value. So I would implore you to
- send the contents of both the settings file and the total_flow file
- Try replacing the content of the total flow file with a 0.0 (no quotation marks)
- if that doesn't help delete the total flow file
I didn't actually change anything in the script only set it to be able to print the total flow and flow rate to SSH terminal. Take this with a little grain of salt but I'm using c++ fstream to manage the file with ios::Out flag. With this if the file doesn't exist it will create it and write data to it, if the file does exist it will overwrite the data in the file with new data. The file never has more than one line. The script doesn't read any files, only reef-pi reads them. If @Wolfw28 can install the new script and set the "debug" setting to 1 and run manually as you indicated we should know more where the problem lays.
 

Sral

Active Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
238
Reaction score
262
Review score
+0 /0 /-0
Location
Germany
I didn't actually change anything in the script only set it to be able to print the total flow and flow rate to SSH terminal. Take this with a little grain of salt but I'm using c++ fstream to manage the file with ios::Out flag. With this if the file doesn't exist it will create it and write data to it, if the file does exist it will overwrite the data in the file with new data. The file never has more than one line. The script doesn't read any files, only reef-pi reads them. If @Wolfw28 can install the new script and set the "debug" setting to 1 and run manually as you indicated we should know more where the problem lays.
We already know, his error message says that there is a problem with a StringToFloat (stof) conversion. That only appears at two positions in the script: reading the calibration factor from settings and reading the total flow, so he can add to that value.

My guess is that the file got Corrupted, maybe during a power reset or a spurious error, possibly due to cosmic radiation, and now can’t convert the garbage to a float, throwing the exception. Either correcting the file or deleting it should work fine.

The deletion command should be:
Move to directory:
cd /var/lib/reef-pi/flowmeters/
Verify that the files are there by printing all files:
ls
(That’s an L and an S)
Delete the total flow files:
rm totalFlowS_0.txt
rm totalFlow_0.txt
 
OP
Wolfw28

Wolfw28

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Mar 13, 2022
Messages
80
Reaction score
57
Review score
+0 /0 /-0
Location
Myakka City
I didn't actually change anything in the script only set it to be able to print the total flow and flow rate to SSH terminal. Take this with a little grain of salt but I'm using c++ fstream to manage the file with ios::Out flag. With this if the file doesn't exist it will create it and write data to it, if the file does exist it will overwrite the data in the file with new data. The file never has more than one line. The script doesn't read any files, only reef-pi reads them. If @Wolfw28 can install the new script and set the "debug" setting to 1 and run manually as you indicated we should know more where the problem lays.
@robsworld78 I did actually what you said I downloaded the new file from you select 1 for debug and got the same error message invalid_argument.
 

robsworld78

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
Feb 14, 2020
Messages
835
Reaction score
1,116
Review score
+0 /0 /-0
Location
Edmonton, Canada
@Sral figured it out, sorry I missed the error you posted. Some cosmic radiation did strike and corrupted the totalFlowS_0.txt file, I was able to easily repeat the problem. I added a try{} catch{} so it won't crash, now if that happens it will simply overwrite the file with a 0 and start over.

@Wolfw28 run the install again, this time it should run without the error. @Sral instructions to fix are valid but once you update it should sort it's self out, this is a good test.
 
OP
Wolfw28

Wolfw28

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Mar 13, 2022
Messages
80
Reaction score
57
Review score
+0 /0 /-0
Location
Myakka City
@Sral figured it out, sorry I missed the error you posted. Some cosmic radiation did strike and corrupted the totalFlowS_0.txt file, I was able to easily repeat the problem. I added a try{} catch{} so it won't crash, now if that happens it will simply overwrite the file with a 0 and start over.

@Wolfw28 run the install again, this time it should run without the error. @Sral instructions to fix are valid but once you update it should sort it's self out, this is a good test.
I did the complete install and setup still no working did get this error message, don’t now if has anything to do with my problem.
CB0CD206-5138-456A-92A4-75EB48B81DBC.jpeg
 
Reef Chasers Aquaculture

robsworld78

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
Feb 14, 2020
Messages
835
Reaction score
1,116
Review score
+0 /0 /-0
Location
Edmonton, Canada
I did the complete install and setup still no working did get this error message, don’t now if has anything to do with my problem.
CB0CD206-5138-456A-92A4-75EB48B81DBC.jpeg
Try it once again, I added a line to the install script that will delete all the flowmeter related files before reinstalling them.
 

Sral

Active Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
238
Reaction score
262
Review score
+0 /0 /-0
Location
Germany
Try it once again, I added a line to the install script that will delete all the flowmeter related files before reinstalling them.
It's the folder, as the error happens during a make directory (mkdir) command.
In your install-script the remove command (line 46) comes BEFORE you stop the service (line 61) which is located in the folder you are trying to delete I think. That might stop full deletion of the folder, so you might want to put the stop command at the beginning of the install file.
 
Last edited:
Nutramar Foods
OP
Wolfw28

Wolfw28

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Mar 13, 2022
Messages
80
Reaction score
57
Review score
+0 /0 /-0
Location
Myakka City
@robsworld78 tried your first install Got the error message. Then I tried @Sral method got total flow work but flow rate just shows .02 in Reefpi console. Tried @robsworld78 second install same thing total flow works flow rate reads 0.02.
After correcting this total flow started working set to 0
F0393B43-9442-4BB7-89CE-AC554A005C70.jpeg
 
Last edited:

Sral

Active Member
Review score
+0 /0 /-0
View Badges
Joined
May 2, 2022
Messages
238
Reaction score
262
Review score
+0 /0 /-0
Location
Germany
Great, at least it is working again. Is that value incorrect ?
Maybe we need to adjust the settings or look at the script again. Tell us if that is the case.

Once @robsworld78 adjusts the install-script you should reinstall it again, to keep the error from happening again.
Currently I think you still use the old script that can't handle this error, since the new install doesn't work yet and throws the error you send us.
 
Top Shelf Aquatics

robsworld78

Well-Known Member
Review score
+0 /0 /-0
View Badges
Joined
Feb 14, 2020
Messages
835
Reaction score
1,116
Review score
+0 /0 /-0
Location
Edmonton, Canada
Yeah it probably wasn't able to delete, when I tested it the service probably wasn't running so it did what's expected. I will have the service stopped before the install starts. Anyways glad it's working.
 
OP
Wolfw28

Wolfw28

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Mar 13, 2022
Messages
80
Reaction score
57
Review score
+0 /0 /-0
Location
Myakka City
Well got flowmeter work thank you very much @robsworld78 and @Sral for all your help. Tested the new pump controller only got 20gph flow at highest setting. Factory controller 60gph at lowest setting. Guess I’ll be starting another thread on this subject.
 
BMF signature corals
Top