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

uses a tiny air pressure sensor like for a bloodpressure cuff, a 4" 2mm diptube and a hx711 ADC . Telemetry is via mqtt

If you get chance to share a picture of your float sensor construction, I’d be interested to see it.

And your aquarium too. :smiley:

So you have mosquito or another MQTT server on a VM? Is there a HA install on a VM as well, or is that only for the RPI? How is it all setup?

Mosquitto is running on the pi in the vm as well - it has its own server! I also have Docker running on my desktop for development - I can run the whole system from there if i like (except for any GPIO connections) HA - Pretty sure it has Docker images. Ill know this week.

You have virtual machines running on a RaspberryPi? What VM hypervisor are you using for that? Or are you using Docker to host entire Linux installs? RaspberryPi4 ?

is there a way to PM on this board?

Click the person’s name you want to message and then a pop up will appear, and you can select Message there.

Doesn’t seem to be there for me. Must be because I am new. was going to see if you would like to Skype or something like that - guessing from you being in Netherlands may not be cost effective to call - just did not want to post my contact info on this thread

To be filed under “So long AquaCalculator and thanks for all the fish data logging.”

If you’re like me, you might be logging all your manually performed water test results to an Mobile App like AquaCalculator or one of the others that are available on PlayStore or AppStore. These apps are simply storing your data in some format like sqlite or something else. And it finally dawned on me this last weekend - why am I storing my pH and NO3 and temp values in a SQL database (behind Home Assistant) while I am storing all my manually performed water tests in a different Mobile App, when Home Assistant is right there on my phone.

So I thought I’d fix that this week too. Here’s a screenshot of how it all came out and looks. (Click to zoom - it’s a very TALL screen capture because I have a display rotated into Portrait mode just for Home Assistant.)

There’s not a lot of data (only from the last few days) to display, but enough to get an idea. In the very bottom right hand corner is the Reef Water Levels Input box, where I can manually enter the results of my CA, MAG, ALK, NO3, IRON, and Salinity Tests. I used input_numbers to create these, which are then used to define the history_graph inputs, and then just added those history_graphs to my group.yaml. Easy peezy.

I even solved a minor UI Interface issue I that was always an annoyance for me with AquaCalculator. My Hanna ALK meter returns a value of PPM for Alk. But I prefer to have that value in dKH. But there was no way to just input the PPM value into AquaCalc and have it automatically convert this to dKH. I either had to go to the “Conversions” page of AquaCalc for this function, or task switch to the Calculator App on my phone and multiply the PPM number by 0.056, to get the dKH value. Using HA, I fixed that. Now I enter in the PPM into Home Assistant and it displays in dKH in the graph.

Note: I’m still not up to speed on Lovelace … I’m porting everything over to that currently, but it’s slow going, so examples are based on the old UI of HA. I’ll update with another post when I get this function working in Lovelace with some even bette eye-candy.

Here’s the YAML code for input_numbers.yaml:

# Aquarium External Test Data log
reef_calcium:
  name: Reef CA Level
  min: 300
  max: 800
  step: 1
  mode: box
#  initial: 530
  unit_of_measurement: ppm

reef_alkalinity:
  name: Reef ALK Level
  min: 0
  max: 200
  step: 1
  mode: box
#  initial: 125
  unit_of_measurement: ppm

reef_iron:
  name: Reef Iron Level
  min: 0
  max: 1
  step: 0.01
  mode: box
#  initial: 0
  unit_of_measurement: ppm

reef_magnesium:
  name: Reef MAG Level
  min: 1200
  max: 2000
  step: 1
  mode: box
#  initial: 1580
  unit_of_measurement: ppm

reef_nitrate:
  name: Reef NO3 Level
  min: 0
  max: 200
  step: 1
  mode: box
#  initial: 25
  unit_of_measurement: ppm

reef_relative_density:
  name: Reef Relative Density
  min: 1.020
  max: 1.030
  step: 0.001
  mode: box
#  initial: 1.0262
  unit_of_measurement: psu

This went into my history_graphs.yaml:

  reef_calcium_graphs:
    name: Reef CA History
    entities:
      - input_number.reef_calcium
    hours_to_show: 720
    refresh: 300

  reef_magnesium_graphs:
    name: Reef MAG History
    entities:
      - input_number.reef_magnesium
    hours_to_show: 720
    refresh: 300

  reef_alkalinity_graphs:
    name: Reef ALK History
    entities:
#      - input_number.reef_alkalinity
      - sensor.alkalinity_ppm_to_dkh
    hours_to_show: 720
    refresh: 300

  reef_iron_graphs:
    name: Reef Iron History
    entities:
      - input_number.reef_iron
    hours_to_show: 720
    refresh: 300

  reef_nitrate_graphs:
    name: Reef NO3 History
    entities:
      - input_number.reef_nitrate
    hours_to_show: 720
    refresh: 300

  reef_relative_density_graphs:
    name: Reef Relative Density History
    entities:
      - input_number.reef_relative_density
    hours_to_show: 720
    refresh: 300

If you read the code in the section above for history_graphs, you might have noticed the ALK history_graph uses a sensor, instead of the input_number directly (it’s commented out). That’s because I perform the ALK PPM to dKH conversion using a sensor.

That declaration in sensors.yaml looks like this:

- platform: template
  sensors:
    alkalinity_ppm_to_dkh:
      value_template: "{{ (float(states('input_number.reef_alkalinity')) * 0.056 ) | round(2) }}"
      unit_of_measurement: '˚dH'
      friendly_name: 'Reef ALK Level'

And finally added these two items to groups.yaml:

  reef_water_levels:
   name: Reef Water Levels
   control: hidden
   entities:
   - history_graph.reef_ca_history
   - history_graph.reef_alk_history
   - history_graph.reef_iron_history
   - history_graph.reef_mag_history
   - history_graph.reef_no3_history
   - history_graph.reef_relative_density_history


  reef_water_levels_input:
   name: Reef Water Levels Input
   control: hidden
   entities:
   - input_number.reef_calcium
   - input_number.reef_alkalinity
   - input_number.reef_iron
   - input_number.reef_magnesium
   - input_number.reef_nitrate
   - input_number.reef_relative_density

There you have it. Now Home Assistant and whatever SQL database you have it tied to, can also be your complete solution for logging ALL your aquarium parameters, even the water tests you perform by hand. Once you input a value into HA, it’s immediately saved to the SQL Database & the graph updates.

Note: consider your auto-delete settings for your SQL database and set it so you can save these values for 6 months, 1 year, 2 years, etc., while all other HA log data gets purged at more reasonable time values…like 1 weeks, 1 month, etc. I know myself, I never am interested in the data after about a year or two.

Maybe you want to have TWO sets of data logs for your aquarium, using a Mobile App and HA for redundancy, incase your Mobile App or the cloud solution behind it screws up your data logs.

Or maybe you want to chuck your Mobile App all together, now you can begin to do so.

AquaCalc is pretty cool for what it does. I’ve just never been too keen on some of the User Interface decisions they took, and all it’s really doing is just some mathematical formulas & logging the data. I’m thinking to port over even more of this functionality to integrate into HA, like the Balancing Baling Salts and maybe a few more as I get the free time to do so, and can track down the math formulas to do so.

Also, I had the idea while writing this up, I’ll add a SECOND Input panel, but instead of using it to enter in the water test results, I’ll use that to set a visual MAX and MIN values for each kind of water test performed, and display those two values inline in history_graph. That way, if I have to leave the Wife in charge of performing water tests while I’m out of town or something, she can see instantly if the dKH value is high or low on the graph. (She’ll never remember what a good value is, so anything I can do to make this easier for her, is a WIN.)

I hope this is useful to others. As always, I’m interested to hear feedback, if you come up with improvements or if you just implement this yourself. And it’s nice to hear if I’m helping anyone else writing all these ideas up. :slight_smile:

Hi,
thank you for the code, tried it out with hass.io on virtual box and didnt work with me since am totally new to home assistant i must be missing something or doing something wrong, and bought the seneye last week just to integrate it with home assistant, i hope that someone has figured out how to do the API with hassio,

What code did you try? And how’s your Seneye connected? Via the SWS or SCA application on Windows?

Hi,
I have tried the shell script that you have provided, whwn i open the api webpage with my credentials its working fine, and whwn i execute the script as a standalone on the pi its working perfect, but when i do it on the home assistant nothing happened not even an error log, maybe am doing it wrongly, i will try again tonight, am running the seneye on a win10 machine and also i have home assistant installed on the same machine on virtual box
My intention is to display the seneye reef reading and also publish them to a separate mqtt and display the values on Blynk application, since somehow my homeassitant server is blocked at my work, so i though to run a separate nodemcu running blynk webserver as a bridge between homeassistant and blynk local server,
Also am building some sensors for the aquarium and so far so good i have 6 sensors connected to tasmotized nodemcu also will bridge them to blynk for my family on their phone incase i wasn’t available they could still access all the readings will share my small project when am done with the seneye readings since this is the first time am into automation and arduino, last month i didn’t know anything about micro controllers and arduino on general, now i built home security system with rf bridge and home assistant and a continuing building aquarium multi sensor and controller :slight_smile:

Hi Sadoo,

Okay, unfortunately, I don’t use Hass.IO here & am a little unfamiliar with the current build & how it functions in practice. But if I recall correctly, I think Home Assistant is running in a hypervisor docker container that doesn’t have access to the underlying OS’s file system, which is where your scripts are probably running for the API functionality.

If I am correct, and that’s the case, you probably have at least one, if not two options.

1.) move the bash scripts from the Host OS outside of the hypervisor, into the hypervisor layer where Home Assistant runs within. It appears that this might give you a starting point on how to do this.

https://developers.home-assistant.io/docs/en/hassio_debugging.html

2.) alternatively, break out of the hypervisor level and access the results of the scripts on the Host OS layer. However, this seems like a much less secure approach. If someone compromises your HA environment, there is some risk they can break out of the hypervisor using the same path you created for the API scripts and you lose any security benefit of the hypervisor layer. If that’s the path you have to go, I might suggest just backing up and follow the DIY instructions on how to roll your own Home Assistant using ‘venv’ virtualised layer (this is how my RPI’s are built).

But if you still want to go with #2 - this seems the way to do that:

There may be more helpful URLs on how to deal with this. Try searching with Google or DuckDuckGo the keywords “Hass.IO shell command”.

It’s on my list of things to do: Break down and install Hass.IO and investigate it again for my own use, but I won’t have time to do that before March unfortunately.

^^^^^^ That is freakin’ awesome & put a HUGE smile on my face!!! Thanks for sharing it. :smiley:

Thank you so much, it’s a good starting noing for me :),. i will try to work on it this weekend, but if it didn’t work, then i will go with node red (rest Api approach) if i knew how to do it, i will watch some videos and see how it will goes and will report back to you, most of folks suggested to go with Node red when it comes to scrape API calls, but am still not sure how much reliable this approach will be, will try first to make node red get the data and save it on a file to be able to report on the historical data instead of the seneye web application, and then publish an MQTT msg to be able to integrate it with Blynk application, since it’s not blocked on my work network :blush:,
but again many thanks for your suggestions, you are the best! :blush:

you’re welcome, will share my small aquarium (sensor/controller) project when it’s done integrating and putting all the piecies together, today am working on the water detection sensor, and will see how it will goes :slight_smile:

Hi,
i have a very wonderful news, i was able to get the Seneye data via node red, no need for scripts or other shells, just node red, but the device have to be connected to a computer, so it’s not a stand alone solution, also i have integrate all my sensors to Blynk application and it looks good, so i will install the application to my family and then they can also see all the sensors,
what i have done so far:
seneye readings.
diy aquarium monitor that includes:

  1. room temp
  2. waterproof temp for the aqurium,
  3. water level via ultrasonic
  4. 2 water leak detectors: controller as analog to digital converter and then done the propes my self with a cooper tape, will give later an image how i have done it.
  5. puzzer if any value went down or up
  6. led controller, it lights up if any issue with the values i already defined
  7. 6 electrickal pulbs to monitor all the filters and the heater and the lights
    when i have more time next week i will give a full picture about what i have done,
    it’s not perfect and not the best solution, but am totally new to this world and i’ve been learning for only a month now how all fits together and how it can be done :slight_smile: so am pretty proud of myself to be honest that i came up with this,
    it’s not the cheapest solution and not the perfect one, but it fits my needs,
    this is a sneak peak on the Blynk app page:

if anyone have any question i will be happy to reply :slight_smile:

2 Likes

Update on the inputs for the manually performed Water Tests. I’m honestly really digging this instead of using the AquaCalculator App on my phone. And today I made it do something I don’t think is in the AquaCalc app - automatically compute and track the Redfield Ratio.

If you don’t know what the Redfield Ratio is, it’s the Ratio of Carbon to NO3 to PO4 which in the oceans is at 106:16:1. In my opinion and experience, chasing the Redfield Ratio is far more beneficial than trying to chase Ultra Low Phosphates and Low Nitrates arbitrarily. if you’ve ever seen someone’s extremely beautiful coral aquarium but heard they were running Nitrates at 30-50ppm with no ill effects… that’s probably because they were hitting the Redfield Ratio pretty spot on. And I’ve experienced this myself over the decades - Explosive coral growth despite the fact that Phosphates and Nitrates were well above what they should be (and certainly not checkable with my Hanna Phosphorous ULR meter).

And while I don’t have a carbon test kit, I can at least track the ratio of NO3 to Phosphate, and now that’s tracked by Home Assistant too.

You might have to click these images to see the full interface. :slight_smile:

Screen Shot 2020-03-01 at 17.25.39

Here’s the code to set this up for the Redfield Ratio. Note: there is no input value to be made for the Redfield Ratio, because that’s computed by the sensor definition based off of NO3 and PO4 values measured. (and my Phosphate value is computed by another sensor to convert between ‘ppb’ to ‘ppm’. If you don’t use a ULR Phosphate test that measures parts per billion, you probably can just use the input_number for phosphate, and don’t have to convert this.) But there is an input_range to create the Max, Min and Target value graphs.

Also note: If you use Lovelace, you’ll have to update this code to work under that. I’ll update my post when I port this over to Lovelace - something I am still working on for my whole HA setup.

sensor:
- platform: template
  sensors:
    redfield_ratio:
      value_template: "{{ ((float(states('input_number.reef_nitrate'))) / (float(states('sensor.phosphorous_to_phosphate')))) | round(1) }}"
      unit_of_measurement: 'ratio'
      friendly_name: 'NO3(n):PO4(1)'


history_graph:
  reef_redfield_ratio_graphs:
    name: Reef Redfield Ratio History
    entities:
      - sensor.redfield_ratio
      - input_number.reef_redfield_ratio_minimum
      - input_number.reef_redfield_ratio_target
      - input_number.reef_redfield_ratio_maximum
    hours_to_show: 720
    refresh: 300

input_number:
reef_redfield_ratio_minimum:
  name: NO3 Ratio Min
  min: 0
  max: 30
  step: 1
  mode: box
#  initial: 5
  unit_of_measurement: ratio
reef_redfield_ratio_target:
  name: NO3 Ratio Target
  min: 0
  max: 30
  step: 1
  mode: box
#  initial: 16
  unit_of_measurement: ratio
reef_redfield_ratio_maximum:
  name: NO3 Ratio Max
  min: 0
  max: 30
  step: 1
  mode: box
#  initial: 19
  unit_of_measurement: ratio


group:
  reef_water_levels:
   name: Reef Water Levels
   control: hidden
   entities:
   - history_graph.reef_ca_history
   - history_graph.reef_alk_history
   - history_graph.reef_iron_history
   - history_graph.reef_mag_history
   - history_graph.reef_no3_history
   - history_graph.reef_phosphate_history
   - history_graph.reef_redfield_ratio_history
   - history_graph.reef_relative_density_history

  reef_water_levels_input:
   name: Reef Water Levels Input
   control: hidden
   entities:
   - input_number.reef_calcium
   - input_number.reef_alkalinity
   - input_number.reef_iron
   - input_number.reef_magnesium
   - input_number.reef_nitrate
   - input_number.reef_phosphorous
   - input_number.reef_relative_density
   - input_boolean.water_tests_levels_ranges

  reef_water_levels_ranges:
   name: Reef Water Levels Ranges
   control: hidden
   entities:
   - input_number.reef_calcium_minimum
   - input_number.reef_calcium_target
   - input_number.reef_calcium_maximum
   - input_number.reef_alkalinity_minimum
   - input_number.reef_alkalinity_target
   - input_number.reef_alkalinity_maximum
   - input_number.reef_iron_minimum
   - input_number.reef_iron_target
   - input_number.reef_iron_maximum
   - input_number.reef_magnesium_minimum
   - input_number.reef_magnesium_target
   - input_number.reef_magnesium_maximum
   - input_number.reef_nitrate_minimum
   - input_number.reef_nitrate_target
   - input_number.reef_nitrate_maximum
   - input_number.reef_phosphorous_minimum
   - input_number.reef_phosphorous_target
   - input_number.reef_phosphorous_maximum
   - input_number.reef_redfield_ratio_minimum
   - input_number.reef_redfield_ratio_target
   - input_number.reef_redfield_ratio_maximum
   - input_number.reef_relative_density_minimum
   - input_number.reef_relative_density_target
   - input_number.reef_relative_density_maximum

A further footnote about my recent experience with the Redfield Ratio:
This Christmas I quite literally cleaned my deep sand bed too much. Normally I shouldn’t do more than 25% at any one time. I ended up on “auto-pilot” during the cleaning exercise and cleaned the whole darn thing. On top of that, I had not realised my auto-doser ran out of Trace Iron, which fertilises my Chaeto algae in my refuge. As a result, my NO3 and PO4 went ballistic, with NO3 testing at 100ppm, and PO4 simply not registering on my Hanna Phosphorous ULR meter. Best I can estimate is that I was somewhere above (NO3)100:(PO4)1. As could be expected, nuisance algae and even a Dinoflag bloom resulted. As the deep sand bed has been recovering, and NO3 and PO4 values have slowly come back to their more normal ranges…so too has the Redfield ratio (currently around 12.9:1 ) and as such, hair algae and bryopsis and even the Dinoflag bloom are now finally receding. And my corals are looking super fat and much more happy, once again.

So I think it’s an important value to track, to better understand the health of your tank and corals. If you never have tracked it before, give it a try with Home Assistant. :slight_smile:

Enjoy!

1 Like

@sfgabe I don’t know what I have to do with the coockie. Should I do something on the reef-pi too?
I’ve added both sensors, but no values.

@florisi You shouldn’t have to do anything on the reef-pi setup, aside from check the cookie string and copy it. Check this yaml for where to put the cookie info:

Note, I’ve since switched to this auger style feeder, new feeder script on my github here.