float switch besides ato for outlet control

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,345
Reaction score
1,722
Location
Missouri
Rating - 0%
0   0   0
Maybe I'm tired but I have a new build that is an AIO and what I wanted to do was have a float switch mounted low in the return section that if the float ever was triggered it was shut the return pump off and notify me. At first I thought oh I'll just wire it up as an ATO port and let it shut off when triggered but soon discovered thats probably not the best way to achieve this since its on almost all the time it really doesnt fit the profile. If I could turn the metrics off then I think it would work for what I want but basically my use case is opposite of how the ATO was originally defined for.

Any suggestions as to how to do what I am wanting to do with a float switch?

Thanks
 
OP
OP
bishoptf

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,345
Reaction score
1,722
Location
Missouri
Rating - 0%
0   0   0
Get an Apex, or learn Raspberry pi
Lol you know you're in a reef-pi sub-forum, pretty sure I'm not going to get an Apex, rofl....I have at the moment 4 reef-pi's running happily doing what I need to do, I just wasn't sure how to incorporate a float switch wanting something different than a standard ato inlet....

get an apex, bwhahahaha that was funny... :)
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Should be manageable, make the ATO "One-shot" and let it run a macro that:
- turns off the pump
- sends you a message

If I'm not mistaken, that should do the trick.
You'll have to reset the ATO manually of course and watch the "one-shot" setting (it might turn off when it gets triggered).
 
OP
OP
bishoptf

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,345
Reaction score
1,722
Location
Missouri
Rating - 0%
0   0   0
Should be manageable, make the ATO "One-shot" and let it run a macro that:
- turns off the pump
- sends you a message

If I'm not mistaken, that should do the trick.
You'll have to reset the ATO manually of course and watch the "one-shot" setting (it might turn off when it gets triggered).
yeah I was looking at all the options the problem that I see is that I want the pump on all the time and so it continually logs it and I think that would be an issue. What I want is kind of the opposite, I would like to reverse the logic and only record the off time, essentially if the float is triggered and it stays down for x seconds then disable and turn off the pump. Or I'd like a option to not graph the output, that would work for me also, just an on/off option and disable on alert etc..

@Ranjib can I do this currently with an inlet? I want to have a float monitor my return chamber (AIO) and turn the pump off if the water level ever drops super low, vs burning up my pump. ATO function works but I kind of need it in the opposite configuration vs what it is currently.
 

Reefering1

Valuable Member
View Badges
Joined
May 20, 2022
Messages
1,663
Reaction score
1,737
Location
Usa
Rating - 0%
0   0   0
Maybe I'm tired but I have a new build that is an AIO and what I wanted to do was have a float switch mounted low in the return section that if the float ever was triggered it was shut the return pump off and notify me. At first I thought oh I'll just wire it up as an ATO port and let it shut off when triggered but soon discovered thats probably not the best way to achieve this since its on almost all the time it really doesnt fit the profile. If I could turn the metrics off then I think it would work for what I want but basically my use case is opposite of how the ATO was originally defined for.

Any suggestions as to how to do what I am wanting to do with a float switch?

Thanks
You can use a spdt relay to convert it to operate as normally off, then when the relay turns off it closed the n/c contacts...
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
You can use a spdt relay to convert it to operate as normally off, then when the relay turns off it closed the n/c contacts...
You can get the same by simply inverting the outlet that the pump is connected to in ReefPi :grinning-face-with-sweat:

Problem there is that when the ATO is triggered for too long it sends an alert and switches the pump „off“, which would make it run again in the inverted logic (both spdt relay and outlet inversion)
 

gbroadbridge

2500 Club Member
View Badges
Joined
Mar 25, 2021
Messages
4,049
Reaction score
4,214
Location
Sydney, Australia
Rating - 0%
0   0   0
Maybe I'm tired but I have a new build that is an AIO and what I wanted to do was have a float switch mounted low in the return section that if the float ever was triggered it was shut the return pump off and notify me. At first I thought oh I'll just wire it up as an ATO port and let it shut off when triggered but soon discovered thats probably not the best way to achieve this since its on almost all the time it really doesnt fit the profile. If I could turn the metrics off then I think it would work for what I want but basically my use case is opposite of how the ATO was originally defined for.

Any suggestions as to how to do what I am wanting to do with a float switch?

Thanks
Maybe I'm missing something, but mount the float switch upside down.
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Maybe I'm missing something, but mount the float switch upside down.
That’s a great idea !
Should work similarly to inverting the inlet though.

It also probably won’t quite work regarding the alert, since that’s currently bound to the ATO being activated for „too long“.
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
yeah I was looking at all the options the problem that I see is that I want the pump on all the time and so it continually logs it and I think that would be an issue. What I want is kind of the opposite, I would like to reverse the logic and only record the off time, essentially if the float is triggered and it stays down for x seconds then disable and turn off the pump. Or I'd like a option to not graph the output, that would work for me also, just an on/off option and disable on alert etc..

@Ranjib can I do this currently with an inlet? I want to have a float monitor my return chamber (AIO) and turn the pump off if the water level ever drops super low, vs burning up my pump. ATO function works but I kind of need it in the opposite configuration vs what it is currently.
It won’t be logged if you invert the outlet. That way the ATO thinks the pump is off, while the pump does its normal operation and when the ATO triggers it switches the pump, which will turn the pump off due to the inverted outlet.

Downside is that you can’t really use the „alert on overuse“ feature, since that would switch the equipment again (e.g. turn the pump back on when you use an inverted outlet).

That’s why I recommended the one-shot ATO with a macro, that way there is no logging, since the ATO only sees a macro. Downside might be that the pump won’t turn back on again by itself, since it’s one-shot.

Do you need the pump to turn back on again by itself when there is enough water again ?
 
OP
OP
bishoptf

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,345
Reaction score
1,722
Location
Missouri
Rating - 0%
0   0   0
It won’t be logged if you invert the outlet. That way the ATO thinks the pump is off, while the pump does its normal operation and when the ATO triggers it switches the pump, which will turn the pump off due to the inverted outlet.

Downside is that you can’t really use the „alert on overuse“ feature, since that would switch the equipment again (e.g. turn the pump back on when you use an inverted outlet).

That’s why I recommended the one-shot ATO with a macro, that way there is no logging, since the ATO only sees a macro. Downside might be that the pump won’t turn back on again by itself, since it’s one-shot.

Do you need the pump to turn back on again by itself when there is enough water again ?
So my floats I can reverse the float and it works in opposite, the problem is still in the logic, I essentially want the outlet to register off when its really on and turning the float upside down doesn't really change the logic. The ato feature is driven by recording how long the pump is on, that way you can have values established where if it overruns it shuts off. It's really makes for a great ATO setup, my issue is when the float is in the on position it wants to keep recording no matter how you set it up. What I think I would like and why I was asking @Ranjib is if I could get an option on the ato to disable the recording finction and just use it as an on/off trigger, that is really what I am after.

I tried the one-shot with macro last night and I still saw it recording, going to play more with it this am but I did not see how that was going to help me.

Just ran the one shot and it still records at least on 5.2 the pump usage, so I do not think that really helps. From what I am seeing currently, unless I am missing something I do not think I can use the current ATO function to do this. I will say if you have the ato configured to control nothing it will not record but then I have no way of turning off the pump, I can set an alert in grafana or maybe a cron to check the status of the float and trigger it outside of reef-pi but was looking for a cleaner way...

Screenshot at 2023-04-29 07-38-57.png
This is more of what I want, this is with control disabled, journal log output: Screenshot at 2023-04-29 07-46-36.png

No usage but you can clearly see the state change, that is what I would like but with being able to trigger an outlet :)

Here is macro with one shot configured from cli, note the usage going up and up and away.... Screenshot at 2023-04-29 07-54-09.png
 
Last edited:
OP
OP
bishoptf

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,345
Reaction score
1,722
Location
Missouri
Rating - 0%
0   0   0
Something like this I think will work, still noodling on how to make it better, there appears to be a delay in the execution, since its reading the log real time I expected it to print a message out each time it saw the log entry but appears to be spitting them out in batches...

Screenshot at 2023-04-29 08-33-47.png



Had to do a screen shot since the stupid forum filters won't allow me to past the script. But think you get the idea, have a cron job run every 20s or min to run a script to check the log and if it sees the message fire the reef-pi api command to turn off the outlet. Not the prettiest but not sure how else to do it. The other way I can think of is to set an alert on grafana and when it sees the alert, fire off the api command that way. Will have to see what options I have with grafana to issue a command vs email etc...

lol maybe I will go have chatgpt write me better code :)
 
Last edited:

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Another idea:
Try setting up two ATOs on the same inlet:
One without any control that you can use for displaying the state, but without Usage and the other one-shot running the macro alerting you and turning off the pump.
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,058
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
We really have to summarize these use cases and provide a neat way to use float switch (or any digital input) for general purpose control outside ato, which is very limiting
 

Townes_Van_Camp

Valuable Member
View Badges
Joined
Apr 14, 2021
Messages
1,951
Reaction score
3,229
Location
Jacksonville, FL
Rating - 0%
0   0   0
You can get the same by simply inverting the outlet that the pump is connected to in ReefPi :grinning-face-with-sweat:

Problem there is that when the ATO is triggered for too long it sends an alert and switches the pump „off“, which would make it run again in the inverted logic (both spdt relay and outlet inversion)
You can use a spdt relay to convert it to operate as normally off, then when the relay turns off it closed the n/c contacts...
You should get an Allen Bradley PLC. Learn to code. After you finish that let me know and I'll be able to get you a PLC cabinet for cheap from work. You may have to replace the cabinet exhaust fans. But those are cheap and easy, about $250 each. We are constantly switching them out as we migrate and split PLC's for speed. Probably 3k will be enough for the used cabinet. I'd watch ebay for a plc you wont need much power. after you fully automate You wont have to worry anymore.
 
OP
OP
bishoptf

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,345
Reaction score
1,722
Location
Missouri
Rating - 0%
0   0   0
We really have to summarize these use cases and provide a neat way to use float switch (or any digital input) for general purpose control outside ato, which is very limiting
My use case I just want to use it to trigger an outlet but I do not want to record usage, basically I want like it's working with control being set to nothing. It triggers a state of 1 or 0, it just doesn't record usage which works for what I want to do. So I want it to do the same but have the ability to control an outlet, macro etc. Just need another option not sure what you would call it, control without usage, lol.

In the mean time I have installed swatchdog and based on the state I am executing api commands to turn the outlet off, kind of works, I need to do some more testing in the morning but I think I am close...

Code:
Apr 29 23:12:58 atollpi reef-pi[6543]: 2023/04/29 23:12:58 ato-subsystem: sensor: atoll-ReturnPump state: 0
Apr 29 23:12:58 atollpi reef-pi[6543]: 2023/04/29 23:12:58 ato-subsystem: sensor: atoll-ReturnPump  usage: 0
Apr 29 23:12:58 atollpi swatchdog[31559]: SwatchDog Return pump Water level normal
Apr 29 23:12:58 atollpi swatchdog[31561]:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Apr 29 23:12:58 atollpi swatchdog[31561]:                                  Dload  Upload   Total   Spent    Left  Speed
Apr 29 23:12:58 atollpi reef-pi[6543]: 2023/04/29 23:12:58 API Request:'  POST /api/equipment/17/control' from: 127.0.0.1:60916
Apr 29 23:12:58 atollpi swatchdog[31561]: [158B blob data]
Apr 29 23:13:03 atollpi reef-pi[6543]: 2023/04/29 23:13:03 ato-subsystem: sensor: atoll-ReturnPump state: 0
Apr 29 23:13:03 atollpi swatchdog[31563]: SwatchDog Return pump Water level normal


Code:
pr 29 23:12:08 atollpi swatchdog[31518]: [158B blob data]
Apr 29 23:12:13 atollpi reef-pi[6543]: 2023/04/29 23:12:13 ato-subsystem: sensor: atoll-ReturnPump state: 1
Apr 29 23:12:13 atollpi swatchdog[31520]: SwatchDog Return pump Water level low
Apr 29 23:12:13 atollpi reef-pi[6543]: 2023/04/29 23:12:13 ato-subsystem: sensor: atoll-ReturnPump  usage: 0
Apr 29 23:12:13 atollpi swatchdog[31522]:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Apr 29 23:12:13 atollpi swatchdog[31522]:                                  Dload  Upload   Total   Spent    Left  Speed
Apr 29 23:12:13 atollpi reef-pi[6543]: 2023/04/29 23:12:13 API Request:'  POST /api/equipment/17/control' from: 127.0.0.1:58880
Apr 29 23:12:13 atollpi swatchdog[31522]: [158B blob data]
 

dmsc2fs

Active Member
View Badges
Joined
Dec 29, 2021
Messages
449
Reaction score
543
Location
Charleston
Rating - 0%
0   0   0
That’s why I recommended the one-shot ATO with a macro, that way there is no logging, since the ATO only sees a macro. Downside might be that the pump won’t turn back on again by itself, since it’s one-shot.
I tried this many times and was never able to get it to work. Has the bug with a macro fired from ATO been fixed? The last time I looked at the Bugtracker it is still open I think? Anytime I have tried to fire a macro with more than 1 step from the ATO it locks up the R-Pi.

I also tried using oneshot to turn off the pump and alert to email notify that it was turned off. As far as I can tell (without looking at the code) when the oneshot fires the ATO loop ends. i.e. if you enable oneshot the email notification is never sent after the oneshot fires. This was my experience. The way I finally ended up doing this because I was so frustrated with the ATO logic was to raise the float switch a bit higher in my reservoir and mounted a red LED on the cabinet. Now when my ATO is about 80% empty the LED will illuminate telling me to fill it.

I wish I had time to dig into the code more. I would like the float-valve logic to do more than it currently does. i.e. when you install a float valve in the skimmer cup it becomes tricky to try and figure out how to get the skimmer off, and notify you that it is off, for example. i.e. the problems above are the same when you try to use the "ATO" code for any float value work.

If I remember correctly I also think that if you are not controlling anything the alert function does not work.
 
OP
OP
bishoptf

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,345
Reaction score
1,722
Location
Missouri
Rating - 0%
0   0   0
I tried this many times and was never able to get it to work. Has the bug with a macro fired from ATO been fixed? The last time I looked at the Bugtracker it is still open I think? Anytime I have tried to fire a macro with more than 1 step from the ATO it locks up the R-Pi.

I also tried using oneshot to turn off the pump and alert to email notify that it was turned off. As far as I can tell (without looking at the code) when the oneshot fires the ATO loop ends. i.e. if you enable oneshot the email notification is never sent after the oneshot fires. This was my experience. The way I finally ended up doing this because I was so frustrated with the ATO logic was to raise the float switch a bit higher in my reservoir and mounted a red LED on the cabinet. Now when my ATO is about 80% empty the LED will illuminate telling me to fill it.

I wish I had time to dig into the code more. I would like the float-valve logic to do more than it currently does. i.e. when you install a float valve in the skimmer cup it becomes tricky to try and figure out how to get the skimmer off, and notify you that it is off, for example. i.e. the problems above are the same when you try to use the "ATO" code for any float value work.

If I remember correctly I also think that if you are not controlling anything the alert function does not work.
Morning @dmsc2fs, what I am working on will do what you need it to do, it's a little involved at the linux level to get all the bits in place but depending on how comfortable you are with doing stuff at the linux CLI I can outline everything that you need to do in order to get you up and working. Swatchdog is just a log watcher, you just have to install it and configure it to do what you want, then it has built in functions like being able to execute commands and sending email etc, based on log output.

If you are interested I will do a short write up outlining all the bits and at least its documented.... :)
 

dmsc2fs

Active Member
View Badges
Joined
Dec 29, 2021
Messages
449
Reaction score
543
Location
Charleston
Rating - 0%
0   0   0
Morning @dmsc2fs, what I am working on will do what you need it to do, it's a little involved at the linux level to get all the bits in place but depending on how comfortable you are with doing stuff at the linux CLI I can outline everything that you need to do in order to get you up and working. Swatchdog is just a log watcher, you just have to install it and configure it to do what you want, then it has built in functions like being able to execute commands and sending email etc, based on log output.

If you are interested I will do a short write up outlining all the bits and at least its documented.... :)
I am comfortable enough in Linux to say that VIM != VI. hah, yeah old school. I'm interested and will help where I can.
 
OP
OP
bishoptf

bishoptf

Valuable Member
View Badges
Joined
Jan 1, 2019
Messages
1,345
Reaction score
1,722
Location
Missouri
Rating - 0%
0   0   0
I am comfortable enough in Linux to say that VIM != VI. hah, yeah old school. I'm interested and will help where I can.
I'm old school also, really just old but I'm a long time linux user and so if I gloss over something just let me know since I tend to do that...I use vi as my editor for most stuff, lol.

So here is the outline and what is needed to monitor anything that is writing to the log, @Ranjib has done a great job of doing this and based on that logging and his API access you can pretty much automate anything you would like.

Here is what we are going to do and what is needed. We want to do some action based on what we see in a log, I have decided to use a tool called swatchdog - https://manpages.ubuntu.com/manpages/bionic/man1/swatchdog.1p.html that is the man page and goes over all what it can do and it can do a lot of stuff. Here is a article that highlights how it works and what you can do with it - https://www.tecmint.com/swatch-linux-log-file-watcher/ this is piece one, it will allow us to watch the syslog output and look for content and then take action.

The second part is now that we are watching the log output we want to do something when the event happens, this can be done with reef-pi API access - https://reef-pi.github.io/additional-documentation/open-api/ and https://reef-pi.github.io/api.html through the API you can pretty much do everything you can do via the reef-pi gui.

Now that we have the how lets look at how we put it into action...
First thing we need to do is install swatchdog, this is in the repo's and you should be able to apt install the pkg:

The forum security software will not allow me to post the configuration bits so I am attaching them in a text file, which is pretty lame and frustrating but I run into this problem over and over trying to do cli stuff..make it much more difficult to read...see if what I have makes sense...
 

Attachments

  • swatchdog-setup.txt
    3.1 KB · Views: 29
Last edited:

When to mix up fish meal: When was the last time you tried a different brand of food for your reef?

  • I regularly change the food that I feed to the tank.

    Votes: 21 29.2%
  • I occasionally change the food that I feed to the tank.

    Votes: 27 37.5%
  • I rarely change the food that I feed to the tank.

    Votes: 19 26.4%
  • I never change the food that I feed to the tank.

    Votes: 4 5.6%
  • Other.

    Votes: 1 1.4%

New Posts

Back
Top