I've recently been down the rabbithole of Macros and Timers and thought I'd share some of my findings.
So, reef-pi can do the following since 3.0 :
- Run a series of commands called a Macro - (Old news, but one of the most amazing features I believe)
- Use a Timer to trigger a Macro to run.
- Use a Macro to run another Macro or series of Macro's
- Run a Macro in reverse. This runs the Macro steps in the reverse order and also reverses the individual steps - so "turn Item X on" becomes "turn Item X off". So a Macro with 3 steps like below
- 1 - Turn X on
- 2 - Turn Y off
- 3 - Turn Z off will run as follows when run in reverse
- 1 - Turn Z on
- 2 - Turn Y on
- 3 - Turn X off
- To use this reversible function, Macros must have "Make Reversible" - "Yes" selected.
- Once this is selected, you can run the Macro in reverse and you can use Timers and other Macros totrigger that Macro, BUT IT WILL RUN IN REVERSE. You can still run the Macro manually in forward mode, but any attempt to automate it's running will trigger it in reverse.
So for my Auto Water Change (AWC) macro, as long as I triggered it manually, it ran fine. However the only way I could get it to run properly on a timer was to re-write the Macro in reverse. Reversing the series of steps and their actions. This achieved what I was wanting - an AWC done at a preset time with no interaction from me.
This reversing thing isn't a big deal on simple Macros like "Turn X off, wait 300 seconds, Turn X on". If you run that in reverse, its exactly the same as forward. More complex Macros are not the same.
Macro's to run Macro's
I've had a "Feed" macro that I've developed and updated over time to be about an hour long now. It's evolved to be pretty bulletproof. Turning return off, skimmer off, temperature control, plus the chiller / heater off to make sure they aren't running while return is off. Turns wavemaker off for a calm period ofr fish to eat, then sowly turning the various pumps on to distribute the uneaten food so that it doesn't just end up down the overflow.
Now I managed to get a dry pellet autofeeder to run from reef-pi, I would like to be able to have a new Macro that triggers "Feed", waits 3 minutes, then triggers the autofeeder as often as I want. In order to get this right, I either need to re-write the new "Feed with autofeed" Macro or write the old "Feed" macro in reverse.
Not a big deal either way, but if you're planning on trying something similar, these are teh ways I've discovered to get these things done.
What would be nice (I think)
- To be able to have Timers and Macros trigger Macros forward.
- to be able to choose whether the reversible Macro runs steps in reverse, states in reverse, or both. I think I can see uses for all three.
I've rambled a bit in this post, I know, but if my experience helps another user, I'll be a happy boy.
I personally think that this kind of functionality is what makes these controllers some of the most powerful innovations in the reefkeeping hobby in recent years. Well, this and automated testing