If/then/else

servus

Active Member
View Badges
Joined
Jun 7, 2020
Messages
181
Reaction score
147
Rating - 0%
0   0   0
It would be really useful to say:

if skimmer = ON
then wait 5 minutes
ozone = on
endif

or...

if return = OFF
then UV = OFF

Does reef-pi support this? I couldn't find anything related to if/then/else instructions.
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,015
Reaction score
943
Location
Germany
Rating - 0%
0   0   0
It would be really useful to say:

if skimmer = ON
then wait 5 minutes
ozone = on
endif

or...

if return = OFF
then UV = OFF

Does reef-pi support this? I couldn't find anything related to if/then/else instructions.
I believe you can do something like this using macros.
Instead of turning on the skimmer directly, you can activate a Macro, for example called „SkimmerStartup“ and there you activate the skimmer, wait 5 min and then turn on the ozone.
 
OP
OP
S

servus

Active Member
View Badges
Joined
Jun 7, 2020
Messages
181
Reaction score
147
Rating - 0%
0   0   0
I could do the actions with macros, just thinking from a safety perspective... there should be no point in time when the return pump is off and the UV is on. With macros, if I turn a plug off for a reason, there is no failsafe.
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,015
Reaction score
943
Location
Germany
Rating - 0%
0   0   0
I could do the actions with macros, just thinking from a safety perspective... there should be no point in time when the return pump is off and the UV is on. With macros, if I turn a plug off for a reason, there is no failsafe.
Well, within ReefPi this macro approach is currently the only option, as far as I know.

You could of course do this outside of ReefPi using an external service, like @robsworld78‘s flowmeter script. This would regularly ask ReefPi whether your return pump is on and switch the UV accordingly.

Another approach that I just thought of would be if you have a flowmeter installed on that return pump. You can then set an upper and lower threshold at about 1/3 of the nominal flow (+/- the hysteresis) that turns your UV light on or off accordingly (either directly as equipment, if „off“ is possible, or using two macros).
 
OP
OP
S

servus

Active Member
View Badges
Joined
Jun 7, 2020
Messages
181
Reaction score
147
Rating - 0%
0   0   0
Interesting workarounds. I've programmed industrial controllers and embedded systems for years, didn't get around Pi unfortunately, and I'm just looking for that kind of functionality and control... Another example that I'm trying to implement is "push button" to do "x" or "y", physical buttons mounted next to the tank. Anyways, I guess I'm old since I think of physical buttons :D.

I have to take a look at the script, would be nice to have 2 or 3 conditions for one thing. It would be absolutely fantastic to have a ladder programming environment for Pi, or some sort of interpreter for small conditional scripts. Neptune has something similar, should be possible with reef-pi... maybe I'll look into it.
 
OP
OP
S

servus

Active Member
View Badges
Joined
Jun 7, 2020
Messages
181
Reaction score
147
Rating - 0%
0   0   0
You could of course do this outside of ReefPi using an external service, like @robsworld78‘s flowmeter script. This would regularly ask ReefPi whether your return pump is on and switch the UV accordingly.

Where can I find Rob's script?
 

ColoredRock

Well-Known Member
View Badges
Joined
Aug 9, 2021
Messages
856
Reaction score
976
Location
Murrieta, CA (North of San Diego)
Rating - 0%
0   0   0
Where can I find Rob's script?
 
Last edited:

ColoredRock

Well-Known Member
View Badges
Joined
Aug 9, 2021
Messages
856
Reaction score
976
Location
Murrieta, CA (North of San Diego)
Rating - 0%
0   0   0
doh.. wrong one lol
 

ColoredRock

Well-Known Member
View Badges
Joined
Aug 9, 2021
Messages
856
Reaction score
976
Location
Murrieta, CA (North of San Diego)
Rating - 0%
0   0   0
Where can I find Rob's script?
Here is the flowmeter post..

 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,015
Reaction score
943
Location
Germany
Rating - 0%
0   0   0
Here is the flowmeter post..

The most important part is the service that runs it regularly in the background. The program itself would need to check ReefPI’s http API for the status that you want and set other statuses through the same API. The API documentation ships with every ReefPi, you’ll find it at the bottom of the ReefPi webpage after login
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,015
Reaction score
943
Location
Germany
Rating - 0%
0   0   0
(…) Another example that I'm trying to implement is "push button" to do "x" or "y", physical buttons mounted next to the tank. Anyways, I guess I'm old since I think of physical buttons :D.

I have to take a look at the script, would be nice to have 2 or 3 conditions for one thing. It would be absolutely fantastic to have a ladder programming environment for Pi, or some sort of interpreter for small conditional scripts. Neptune has something similar, should be possible with reef-pi... maybe I'll look into it.
Another thing:
The push-buttons should be similarly possible with the class that @robsworld78‘s used for the flowmeter: as far as I unterstand, it uses an „interrupt“ style, e.g. if a digital signal is detected on an input pin (rising- or falling flank, or continuous high or low, depending on the setting) it will run some code. In rob‘s case the script increases flow volume every time a rising(or falling?) flank is detected. In your case you could connect a button and execute some code that acts upon the ReefPi http API (activate equipment, etc).
Variable ladders would possibly be More easy to run with Python, although I expect that the native ReefPi code for things like transform functions or macros already has some kind of script-like possibility that one could extend upon.
 

TOP 10 Trending Threads

HOW DO YOU ADJUST YOUR CUC AS ALGAE DISAPPEARS?

  • Capture and re-home CUC

    Votes: 1 10.0%
  • Increase white light/hours in tank to spur algae growth to feed CUC

    Votes: 1 10.0%
  • Feed nori to support CUC

    Votes: 3 30.0%
  • Feed herbivore pellets to support CUC

    Votes: 1 10.0%
  • Allow attrition to balance CUC and algae

    Votes: 6 60.0%
  • Provide macro algae to feed CUC

    Votes: 1 10.0%
  • Introduce CUC predators

    Votes: 0 0.0%
  • Other (please explain)

    Votes: 1 10.0%
Back
Top