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. 
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. 
Enjoy!

