If/then/else

  • Thread starter Thread starter servus
  • Start date Start date
  • Tagged users None

servus

Active Member
View Badges
Joined
Jun 7, 2020
Messages
176
Reaction score
165
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.
 
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.
 
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.
 
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).
 
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.
 
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?
 
Where can I find Rob's script?
 
Last edited:
doh.. wrong one lol
 
Where can I find Rob's script?
Here is the flowmeter post..

 
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
 
(…) 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.
 

IF YOU HAD TO TAKE A REEFING EXAM, WOULD YOU PASS?

  • Yes!

    Votes: 32 45.7%
  • Not yet, but I have one that I want to buy in mind!

    Votes: 9 12.9%
  • No.

    Votes: 26 37.1%
  • Other (please explain).

    Votes: 3 4.3%

New Posts

Back
Top