Reef-pi + Home Assistant Build

marekd1

Active Member
View Badges
Joined
Dec 24, 2019
Messages
117
Reaction score
180
Review score
+0 /0 /-0
I control my 2 small aquariums (one 40 gal fresh, one 15 gal nano reef) with a combination of Home Assistant (which also takes care of my apartment), Reef-Pi, and Motioneye.

I wanted the tanks to mirror specific locations as much as possible. For example, I’m querying various sites to get daily water temp, tide, and weather data. I also wanted to be able to monitor everything from outside the house, so it needed to be web accessible.

ha_bali.png
The reef tank:
  • Getting temp and ATO sensor data from reef-pi (Raspberry Pi 3B) and publishing via API, which Home Assistant installation can pick up as sensors
  • Water temperature changes daily according to NOAA data, dropping to lower averages at night, and higher at midday depending on the data coming from a reef in Bali.
  • Kessil Tuna Blue A80 fades up / down according to sunrise / sunset times, and offset by two hours so the late-waking humans can enjoy the tank.
  • High and low tides control the Jabao SW2 wavemaker on/off according to a script that increases intensity at mid-tide change for that specific location.
  • Top off and dosing from two peristaltic pumps on the reef-pi build. These are manual for now, because I'm not sure about speed and volume yet.
ha_amazon (1).jpeg
The freshwater planted tank:
  • Getting temp and ato sensor data from scripts on a Raspberry Pi Zero W, and broadcasting to Home Assistant sensors via MQTT
  • Water temp is targeted to a spot in the Amazon River. Amazon water temp data is hard to find so I had to go with monthly averages in a text file.
  • Finnex Fugeray Planted turns on / off according to sunrise / sunset times, offset by one hour, CO2 also goes on and off with the lights.
  • River high and low tides turn an extra pump on/off according to tide change for that location.
  • a pi-enabled barrel feeder, run from a script on a motioneye action button
  • a Pimoroni Octocam, which posts time lapse movies to twitter (@Octo_Cam_bot) and photos and stats for each feeding
reefpienclosure2.jpg reefpienclosure.jpg
Most simple power on/off switching is done with Tuya smart home outlets via home assistant. You can read about the hardware details of the Reef-pi controller on Thingiverse, with the enclosure files. Improvement has become a never-ending project but I think it’s pretty cool so I wanted to share. Will update the Github repository as I can.

Some other resources for aquarium control:
octocam.jpg Screen Shot 2018-12-16 at 9.18.40 PM.png

Nice work on the integration into Home Assistant.

I have a question. I finally started seeing MQTT messages from my ReefPi's but I am not sure if what I am seeing is normal and the same in your case as well. Looks like the MQTT message structure is not exactly as what I am used to seeing. Looks like the messages are published with single topic subscription. For example since there is a field ClientID under MQTT settings this would be listed as a Topic and then the subtopic for the parameter then the value. I am seeing just the subtopic for parameter and value.

I have this info same on all 3 Reef-Pi's so I suspect this is how they are but just wanted to check with you as you seem to have done a lot of work already with MQTT

Here is what I am seeing is yours the same?

1623071495075.png


The typical MQTT structure would be like this..

1623071546999.png
 
Click to watch best scape method in 5 easy steps!
OP
sfgabe

sfgabe

Active Member
View Badges
Joined
Sep 7, 2018
Messages
139
Reaction score
235
Review score
+0 /0 /-0
Nice work on the integration into Home Assistant.

I have a question. I finally started seeing MQTT messages from my ReefPi's but I am not sure if what I am seeing is normal and the same in your case as well. Looks like the MQTT message structure is not exactly as what I am used to seeing. Looks like the messages are published with single topic subscription. For example since there is a field ClientID under MQTT settings this would be listed as a Topic and then the subtopic for the parameter then the value. I am seeing just the subtopic for parameter and value.

I have this info same on all 3 Reef-Pi's so I suspect this is how they are but just wanted to check with you as you seem to have done a lot of work already with MQTT

Here is what I am seeing is yours the same?

1623071495075.png


The typical MQTT structure would be like this..

1623071546999.png
There is no "typical" MQTT structure, though it does seem to be getting more standardized across platforms. It's pretty much up to the developer (in this case @Ranjib ) how those channels are set up. What you have above is correct as of now.

If you have multiple reef-pi's the best you can do is name them with the tank info in the name - as I see you've done with "display_tank..." but as far as I could figure out things like "system_load" can't be changed as of yet, so you'll keep getting conflicting messages on the same channel.
 

marekd1

Active Member
View Badges
Joined
Dec 24, 2019
Messages
117
Reaction score
180
Review score
+0 /0 /-0
There is no "typical" MQTT structure, though it does seem to be getting more standardized across platforms. It's pretty much up to the developer (in this case @Ranjib ) how those channels are set up. What you have above is correct as of now.

If you have multiple reef-pi's the best you can do is name them with the tank info in the name - as I see you've done with "display_tank..." but as far as I could figure out things like "system_load" can't be changed as of yet, so you'll keep getting conflicting messages on the same channel.
Thanks this is exactly what I was thinking. There is an "accepted" standard or best practice for implementing MQTT messaging but I know that MQTT is fairly new for Reef-Pi so hopefully @Ranjib will standardize the messaging so its pinned to the Client ID.

Yes you are correct at this time there is not way to display conflicting for these parameters as these are shared amongst all reef-pi's and descriptor is the same

1623080115297.png


The good news MQTT is working on 2 out of 3 reef-pi's. Still trying to figure out the last one.

Thanks for confirming my findings.
 

marekd1

Active Member
View Badges
Joined
Dec 24, 2019
Messages
117
Reaction score
180
Review score
+0 /0 /-0
I have one more question for you if you could let me know please. Are you presently running any dosing using Reef-Pi? If so are you able to see any messages reported by the devices listed under Dosing Pumps? I am not sure if my observation is correct but it appears that Reef-Pi is reporting devices and their state as listed under Equipment and Lights. It is not reporting any devices under Dosing Pump. At least this is my experience so far.

These are reported:
1623092298106.png

These are not:
1623092334785.png


Here is the MQTT side:
1623092405940.png


are you seeing something simmilar?
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
8,975
Reaction score
15,579
Review score
+0 /0 /-0
Location
Pleasant Hill, Concord
Should i update the reef-pi code to use a specific channel. Sorry , I'm just trying to pick up any improvements you may want to see around the mqtt metrics emission. I am not personally using it, but happy to adhere to any best practices that's not a whole lot extra work for us,
 
Reef Chasers Aquaculture
OP
sfgabe

sfgabe

Active Member
View Badges
Joined
Sep 7, 2018
Messages
139
Reaction score
235
Review score
+0 /0 /-0
Should i update the reef-pi code to use a specific channel. Sorry , I'm just trying to pick up any improvements you may want to see around the mqtt metrics emission. I am not personally using it, but happy to adhere to any best practices that's not a whole lot extra work for us,
Maybe @marekd1 has some suggestions but I imagine something like "reef-pi-name/doser-1/doser-name" would work

The most obvious option would be to just follow the same strings as the API. The one exception is that it would be great to be able to have more than one reef-pi installation with it's own name so that the basics like "system_mem_used" can be differentiated between different installations.
 

marekd1

Active Member
View Badges
Joined
Dec 24, 2019
Messages
117
Reaction score
180
Review score
+0 /0 /-0
Maybe @marekd1 has some suggestions but I imagine something like "reef-pi-name/doser-1/doser-name" would work

The most obvious option would be to just follow the same strings as the API. The one exception is that it would be great to be able to have more than one reef-pi installation with it's own name so that the basics like "system_mem_used" can be differentiated between different installations.
I would suggest to utilize the existing ClientID field in the MQTT section. This would allow at minimum identifying the device. The goal is really just to group the function types/device types

Ideally it world be great if we could associate say {DeviceID}/{Reef-Pi-function}/{Equipment type/Device Type}/

So one example would be as follows:

Device ID set as Doser-01
ReefPi-Function- Dosing pumps
Device type Alkalinity

resulting string would be:
Doser-01/DosingPumps/Alkalinity/


Here is a typical example from one of tasmota devices.

1623760247646.png


resulting string is:

1623761315808.png
 

marekd1

Active Member
View Badges
Joined
Dec 24, 2019
Messages
117
Reaction score
180
Review score
+0 /0 /-0
Should i update the reef-pi code to use a specific channel. Sorry , I'm just trying to pick up any improvements you may want to see around the mqtt metrics emission. I am not personally using it, but happy to adhere to any best practices that's not a whole lot extra work for us,
Ranjib, can you please confirm that MQTT is working for the dosing pumps. I am not able to get any messaging. The only messages for dosing that I have if I built direction control under the Equipment menu. It tells me direction state.

Let me know if you need more examples.

BTW here is nice implementation by Atlas IoT

Device name/Sensor type/device bus address/user label/values

1623764717122.png
 
Last edited:

What is the best "cleaning product" or home recipe for cleaning reef tank equipment?

  • Water and scrubbing

    Votes: 43 14.1%
  • Citric Acid

    Votes: 149 48.9%
  • Vinegar

    Votes: 95 31.1%
  • Hydrogen peroxide

    Votes: 7 2.3%
  • Lemon Juice

    Votes: 1 0.3%
  • Other (please explain)

    Votes: 10 3.3%
Coral-vault.com
Top