Going to next level of Aquarium Automation...who's with me?

Apologies in advance if the answer is yes, but did you happen to read the reply I made to Xinil just 10 days ago? In fact, it was right before your initial post to me. The context function is about liquid dosing pumps, but the method is easily carried over to lights, sprinkler systems, media centres, coffee pots, deep fryers, etc.

And for what it’s worth, I don’t think pure HA / MQTT is a mistake (although I’m curious why you think so?). In some ways, it makes the setup of Application Layer implementation of High Availability a bit easier, as all instances of HA can be subscribed to the same topic (say Temp data from a specific probe which controls your home heater/AC) and your default primary HA VM node can be setup to act on that data, while your secondary HA VM node will only act on that Temp data when the primary HA node is offline, or fails to function properly within a certain time period.

And that latter point, is one of the strengths of Application layer High Availability offers over and above VM based High Availability. With VM based High Availability, I can set triggers to reboot a VM if that VM crashes or kernel panics, but it doesn’t give me the ability to sanity check the logic and functioning health of the Application itself. Application layer High Availability can be setup to constantly sanity check and monitor the functioning health of another node’s application and/or OS VM.

This is very similar to the Space Shuttle or Crew Dragon Flight control systems - 5 redundant computers which all are running the same program, one of which is controlling (primary) and the other 4 are monitoring (secondary) nodes, the later of which are all sanity checking the performance operation of the controlling node. The moment they see the primary go out of expected functional operation - whether do to a complete system crash or a more subtle dropped CPU instruction due to a low voltage condition (which is common on RaspberryPi’s using either underpowered or failing USB Power supplies), one of the designated secondaries will jump in, demote the primary, and take control as the new primary.

And we can do this, we can replicate this kind of functionality, easily and natively inside Home Assistant, because HA gives us the possibility to monitor and control another HA node almost just as if it was a light bulb or smart switch itself, but one that offers a lot more data input to make smart decisions about that HA node’s health and operational state.

The only major difference between my primary and my 4 secondaries is that my secondary nodes have additional bits of conditional evaluation functions in their HA automations to not trigger unless the condition has been meet that a failure scenario has occurred.

BTW, this is another strength of Application Layer High Availability - you can get very granular in deciding what functionality should be mission critical and offered as High Availability, while excluding others that are not. For instance, I like having my dozen security cameras streamed to HA’s interface, and my wife likes the dozen or so Sunset & Beach cams streaming to the HA interface. I have this setup on my VM based instance of Home Assistant, which can easily handle this. But do not have these cameras streaming setup on my RaspberryPi nodes, because they would overload the CPU of RPI’s and they are not mission critical. With VM based High Availability, it’s pretty much all or nothing.

However, there is a role for VM High Availability to play here: Your MQTT server, and this is a perfect scenario for that, because we are not really concerned with MQTT storing data, but we are concerned with MQTT always being available somewhere on the network.

If you want to go down this path, and you haven’t done so yet, I’d go ahead and split your DB servers onto their own VMs on their respective VM hosts, and do the same for the MQTT server. Setup duplicate MQTT servers on both VM hosts under their own VMs that are exactly identical down to the same IP address. The only difference between them is that one should be designated a primary MQTT server that is set to always boot up and run, and the secondary MQTT server will never run, unless the primary MQTT server has crashed / been offline. Unfortunately, I don’t run Proxmox or Unraid, so I’m not exactly sure of how to technically implement that on those platforms, so you might have to research to find out if this is even possible to use the native feature sets of these VM hosts to do that. If it’s not, let me know, and I think I have a work around for that - which is a way I had solved this issue when I first began my use of HA and everything was on only a pure RaspberryPi environment (and before my incorporation of VMs for my primary, primary DB server and MQTT server).

In the meantime, if you want to give me a copy and paste example of an automation you’d like to configure as a High Availability function, I can help show you through that how to set this up in your automations & sensors.

BTW, I’m in the middle of painting my house at the moment, and am limited to periods of rain for time to post here. :slight_smile: If I don’t reply very quickly, that means it’s sunny / not raining here and I’m out painting - I will eventually return, provided I don’t fall off the scaffold and injure or kill myself. :slight_smile:

2 Likes

We would be over the moon if you use our platform to enlighten other hobbyists about how much more is actually possible with aquarium automation. The prices the category captain charges are astronomical and I wish more aquarists knew there were alternatives.

1 Like

@Faze_One Just an update to the last time we talked; revarnishing the exterior of the front side of my house has taken longer than expected due to weather / forgetting how long it takes to sand hard wood (compared to say, pine), and other surprise repairs that had to be made. As soon as I’m wrapped up with that, and enjoy a little bit of remaining holiday time with my wife, I’ll get on that.

Hi Ciwyn, any luck yet with the RA?

No I haven’t really messed around with getting that to integrate.
Now what I was told on the reef angel forums a while ago was that the RA star controller has an MQTT function built into it. So that can be integrated to HA via MQTT.

Unfortunately I think the reef angel controller is really losing ground to the mainstream controllers. So I’m not too keen on buying an RA star.

What I would like to do is set up something similar to what cowboy has done. I just feel like I lack the time right now and I also have to figure out a solution for pH monitoring for my calcium reactor.

I am interrested in knowing how you used a timer on the fluval 3.0.
What in term of hardware and software was used.

thank you

Hi!
This project looks awesome!
I’m completely new to HA, but not new to aquariums.
Where do I start?

I had planned on starting with ardunio / out of the box ATO switches/sensors from Aliexpress, but this thread, and @cowboy system looks incredible. I’m just not sure where/how to start in leveraging the work that has been done.

For example, I have two main tanks a 600L (angles and community) and a 300L (discus). I also have a 120L for a discus pair and a 100L for some angels who are breeding. I have two other tanks but are less concerning. The two breeding tanks are co-located, while the 600/300 are on opposite sides of my main living room.

Not sure where to start with (1) software and (2) hardware. Noting my use cases would be power monitoring and control (for air pumps/water pumps, heater control/fail safe), temp monitoring, pH, NH3 (less priority), water sensors, pump controls (drain x % and refill).

Kind regards,
Jezza

1 Like

Hi everyone,

Very cool thread, I have a long term plan to replace my APEX with HA. In the meantime, I have brought my apex data into HA and started doing some basic monitoring of a small tank in my office.

I wanted to know if anyone is using Bayesian to create new monitoring sensors. Idea - Low sump level

Context:
For example, my large planted aquarium has a automatic continuous water changer that uses an overflow drain in the sump to ensure the sump cannot overflow.

That said, when I have a power outage, some water drains out of the sump. In addition, the continuous water changing system runs for a couple minutes each night to refill evaporation and on saturdays does a 50% water change. This week I had an issue with my RO unit and forgot to reopen a bypass valve after fixing a leaking RO line. Several days later, I noticed that the water level was low in my sump.

A Bayesian sensor could look at the values of PH and ORP and given a sudden and large variation identify that the sump level is below the probes.

I just posted in another thread my issues with the Bayesian YAML code, but thought it might be interesting for this thread too. Would also love to know if anyone is using ML or advanced analytics on the aquarium. It seems like we deal with many stochastic situations that would be well served by applying a statistical control framework.

Thanks

1 Like

Update:
Just code the YAML to work, I still need to run tests to set the definitive parameters, but I was able to do a quick simulation and the binary sensor turned on.

Here is an example of the YAML that you can tweak for whatever use case you have. I highly recommend reading up on Bayesian algorithm and read the implementation parameters before copying this code.

binary_sensor:
  - platform: "bayesian"
    name: "Sump Low"
    prior: 0.01
    probability_threshold: 0.7
    observations:
      - platform: numeric_state
        entity_id: sensor.apex_ph
        prob_given_true: 0.5
        prob_given_false: 0.01
        above: 7.3
      - platform: numeric_state
        entity_id: sensor.apex_orp
        prob_given_true: 0.5
        prob_given_false: 0.01
        below: 440

The result of this is an entity that gives a true-false value for the sump level being low. As I mentioned, the parameters of PH and ORP as well as the probabilities would need to be tuned to your normal aquarium operating parameters. This obviously is not foolproof as other factors could change the parameters, but given that its only used for alerting, there is no danger in alerting me to visually inspect the status of my sump.

1 Like

Nice to see this topic coming into live again.

In terms of aquarium, I am only using HA to turn on/off my lights and CO2 solenoid.

I also have two integer sensors that tells me how many hours of light and CO2 I had ON yesterday.

Again, very nice to see movement here.

What about a water sensor ? Would it solve your problem ?

I could do the same with a high or low float sensor, but that would require more physical hardware. The beauty of the Bayesian solution is to determine the state of the aquarium based on statistical information of other sensors. In my case, by watching the values of PH and ORP when the probes are no longer in the water, I can deduce the state of the water level.

Perhaps this example is somewhat specialized to my particular aquarium setup, but when you consider the reef keeping hobby, the number of variables that come into play are very high and I think the opportunity for data analytics is very high and the idea here was to share the concept and see if others are doing anything interesting in terms of ML or analytics.

Here is a paper that I found online of another potential use case regarding water quality.
https://www.researchgate.net/figure/The-Wireless-Monitoring-System_fig1_355203373

I’ve been thing about new projects and recently one of my Kessil a360 tuna sun lights died. I would love to do something with WLED, but the challenge is finding strips that are ideal aquatic plant lights. Has anyone explored this? It would be very cool to add some general colored light strips along with grow lights to create cool sunrise, sunset, lightening effects in paralell with the ramp up - ramp down of the photo period.

Thanks

Why?

I’ve been following this thread and been getting ideas for a while. But I think I wanted to share what I built. I have a few aquariums in my house and I actually run a small business cleaning and maintaining tanks around town! A lot of fun. I wanted to make something that I can use at home and on the job that is affordable and is Home Assistant friendly. Starting out, I was experimenting and using Reef-Pi to control my tank, but that required a whole lot of custom and DIY stuff for power control, ph, Salinity and dosing. I wanted Home Assistant to be the brains of the control, and integrate with countless other things. Then I looked into ESPHome and its automation potential with HA. I then obtained a 3D printer and decided to see what I can build using some devices and wires sold on Amazon.

What?

I put together something I call AquaPi, powered by a ESP32 and connected to Home Assistant. It has a few I2C probes and sensors to monitor Temperature, pH, Salinity, Dissolved Oxygen, water level and potentially more. Using these probes, and your favorite, but HA compatible, smart plugs/outlets, you can turn things on/off (like an ATO pump or heater) based on water level, temperature or whatever else you want to Home Assistant to control. I’m trying to make something customizable, modular, and affordable. I can’t integrate things that use apps to control, like Red Sea or Fluval, but this is a nice device to supplement those kind of smart things.

How?

Take a look at my GitHub for more information, maybe help me out??

UI

I’m in the process of making the UI pretty, here are some examples:


AquaPi

And some blueprints I use:

Feeding Script

This script is intended to act as a feeding routine for your aquarium fish. You can choose multiple switches to turn off, such as return pumps, wave makers, skimmers, etc., and set the amount of time for feeding, typically 10 mins. The script will turn off the switch(es) for the set time, then turn the them back on automatically.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

2 Part Doser Script

This script is intended to dose your aquarium for a certain amount of time. Choose an entity to turn on, typically a 2 part Doser @ 1.1 mL/min, then set the amount of time to dose for. The script will turn on the target switch for the set time, then the switch will turn off.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

ATO (Automated-Top-Off) Automation

This automation is intended to create an ATO (Automated-Top-Off) automation for your aquarium, or anything else that needs to be refilled. You would use the AquaPi Water Level sensor to determine the presence of water and control a water pump via switch when necessary. The automation will turn the selected switch on when the Water Level is Low, and off then when the Water Level is Normal or High. By default, the switch will automatically turn off after 5 mins of being on to prevent overfill.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

I’m extremely interested in this but it doesn’t look like you’re online store is selling this? (I’m in Orlando btw).

What are you using for ammonia and what not?

I will be soon. I just got a few PCBs printed up for better reliability for sales. Doing testing now! The only real issue is the WiFi inprov reliability, but getting everything else to run smoothly. I’m also creating a version for EZO pumps to dose treatments and water changes! Keep an eye out on the GitHub. I’ll reply when I re-activate the store page! Thanks for your interest. Also, in Tallahassee. Perhaps I can sell you a version at cost, and help me if I missed something!

1 Like

That would be awesome and definitely message me when things are in a great state. The cost of certain automation hubs (Apex cough and Hydros cough) do very little to justify themselves (event their front ends just suck).

Hardware for Vortech equipment is fantastic, but their software (Mobius and whatnot) is severely lacking.

I would love to eventually take Vortech and AI equipment and just plop them in my own automation systems. If I can control a variable speed pump (Syncra), and get some auto testers | sensors in place, some DOSers (Vortech), Lights (AI | Kessil), fans (Vortech), and maybe some water level sensors – we’re 100% in business at that point.

when it comes to some settings, I think their software would be ok to use, but HA would be more generic automations. I would love to be able to set everything ourselves, like lighting and wave settings.

1 Like

And yes, their frontend is crap!!! And way too expensive for what they offer. Granted, some of the stuff, like the probes, are expensive. But I think we can do it better and cheaper. I’m making a dashboard using auto-entities fort easy initial set-up for new users as well. Also, I don’t like Apex Tasks thing. So I am making blueprints for better use.

For ammonia and other microelements, I just created a input_number helper to record the results I get from the test kits. It’s basically a log,. not a sensor.