Reef-PI Home Assistant Integration

Hi!

I created a custom integration for Reef-Pi aquarium automation project (http://reef-pi.github.io/)

Currently it supports:

  • basic information (CPU temperature and attributes) sensor.reef-pi name,
  • temperature sensors (sensor.sensor name)
  • equipment switches (switch.switch name)
  • pH sensors (version 0.1.3)
  • dosing pumps (version 0.1.4)

This is how it looks currently on my dashboard:

2 Likes

It is possible now to install integration through HACS. Just add a custom repository and it will install the integration for you.

@RedViper you should be able to manually install using the method in the readme file. However, that did not work for me. I originally used samba and created the file structure per the github. You do need to remove the .gitignore file though. Once that is installed and HA is restarted the integration will show. The hass route is just an easier method.

The instructions for manual install are updated. It should work now.

1 Like

it is not showing up in HASS

Did you add the url (GitHub - tdragon/reef-pi-hass-custom: Reef Pi integration for Home Assistant) as a custom repository to HACS?

2 Likes

Latest version of the integration (0.1.4) supports pH monitoring and doser pumps.

This is great, thanks for putting this together! I’ve been using manually defined rest entities to connect to reef-pi, but that has been clunky. This is soooo much easier. Any chance you’re able to add ATO sensors? I have 2 optical sensors and a non-contact sensor that I still have to manually define. Thank you!

Yes, I can add support for ATO. Could you provide an example of the ATO rest response or how you configure your rest queries so I can implement similar queries in the integration?

I was thinking wrong when I wrote my previous response. My ATO sensors are actually pulled in via MQTT which is fine with me, so no need to add to the integration unless you/others want it to be more complete. Not sure this helps, but this is my MQTT configuration for 1 sensor:

- platform: mqtt
  name: "Aquarium Low Water Sensor"
  state_topic: "ato_low_water_sensor_state"
  value_template: >-
    {% if value == "1.000000" %}
      on
    {% elif value == "0.000000" %}
      off
    {% else %}
      unknown
    {% endif %}

The problem with MQTT on reef-pi is that you cannot distinguish reef-pi instance if you have more then one. This is the reason I cannot use it in the integration.

I’ll add ATO sensor using rest pull in the next version.

EDIT: I had to do a hard restart of the HA server for the integration to appear in HASS. Doing a “restart” from the Server Controls was not making it appear.

After adding the repository and integration to HACs and then restarting HA, the integration does not appear in HASS.

Was there any errors in the HA log when the integration didn’t appear?

Awesome, I came across this while looking for a a way to automate skimmer and ATO sensor turn off with return pump.

On return pump start I want to add a delay starting up the skimmer to prevent it overflowing and return chamber level stabilizing before ATO starts up again.

It does not seem possible within reef-pi, using home assistant to perform automations seemed a logical choice.

Thanks for creating this custom component, I will try it out and report back.

Ahh, I didn’t realize the ATO sensor was not pulled in. I have only one reef-pi so maybe I can use the solution provided by @TeNpoLe21 for now.

Hello @RedViper got the reef-pi installed, but I turned off my MQTT server as I have moved away from it for Zwave and Zigbee.

Is it possible for you to add the ATO sensors? I tried to mimic the pumps class for the Atos but I was not able to and broke the integration.

The ATO sensors should just come in as a switch (boolean) same as equipment with the ability to turn on and off. I think that would be enough.

Many thanks for your help!

Hi @aamans!
I am confused about ATOs: as I understand this is an automation on reef-pi side that uses a water level sensor to turn a pump on/off.
Do you want to have it as a switch to be able to enable/disable this automation or to control the underlying pump?

Note: that my integration uses polling to get the current status: it polls once a minute to get a status update, so there will be a delay up to 1 minute before HomeAssistant will see a new status. It could be dangerous to control pumps based on delayed status update!

Hello @RedViper,

First, thank you for responding and putting together this integration. It is a tremendous help for non-coders like me and a great help to the community.

I think as a basic function, the same way it presents itself on reef-pi ATO page as an option to turn on/off the automation is what I am looking for.

I had a similar confusion when I was setting up reef-pi, I would turn off the ATO pump in equipment but it would come back on by itself until I realized the ATO sensor and pump were two separate controls. i.e. a manual change in the ATO pump to on/off would not automatically turn the automation on/off. Same goes for timers. Manual control of equipment associated with timers does not automatically turn associated timers on/off, hence controlling equipment without disabling the timers is useless. As such, I don’t see a need to control the ATO Pump. The ATO sensor data/timestamps would be nice to have but not necessary.

Within Reef-pi itself, there is no way to trigger the sensor automation based on the state of other equipment. I have attached my reef-pi card below. My aim is to use the return pump equipment entity to control the ATO automation to be active or not.

I see what you mean about polling, it does take a few seconds for entities to update, but control is near-instant from HA.

For the ATO sensor in sump specifically, it should not be a problem as water levels rise when the return pump is off but take time to stabilize to get to an equilibrium state when the return is turned on so a time delay to turn the ATO automation back on is desired. Furthermore, reef-pi is already controlling the ATO pump once the automation is on.

Maybe a global user-configurable polling setting during integration setup or as a variable for users who need it as a future update?

Thoughts?

Ok, I got the idea now.
It’s good you mentioned timers as analogy, probably I’ll add them as well :slight_smile:

BTW, the manual control for timers makes sense - I use timer to automatically control lights, but when I do maintenance I can turn light on or off manually and they will stay in this state until timer switches them back to “normal”.

I’ll expose ATO as on/off switches and separately as states that will reflect the last time and duration when ATO was on. Options will go to attributes if one want them.

Oh, as I don’t have ATO myself, could you share results of few queries, I’ll use them for tests:
http://{ip_of_your_reef_pi}/api/atos
http://{ip_of_your_reef_pi}/api/inlets
http://{ip_of_your_reef_pi}/api/inlets/{id_of_your_inlet}/read

The id_of_your_inlet you can get from the 2nd query, there will be “id”: {some number}