Reef-PI Home Assistant Integration

Here you go.

http://{ip_of_your_reef_pi}/api/atos

[{"id":"9","is_macro":false,"inlet":"4","pump":"39","period":10,"control":true,"enable":true,"notify":{"enable":true,"max":300},"name":"ATO Sensor","disable_on_alert":true,"one_shot":false}]

http://{ip_of_your_reef_pi}/api/inlets

[{"id":"1","name":"Sensor Port 1","pin":14,"equipment":"","reverse":false,"driver":"rpi"},{"id":"2","name":"Sensor Port 2","pin":27,"equipment":"","reverse":false,"driver":"rpi"},{"id":"3","name":"Sensor Port 3","pin":8,"equipment":"","reverse":false,"driver":"rpi"},{"id":"4","name":"Sensor Port 4","pin":17,"equipment":"","reverse":true,"driver":"rpi"},{"id":"5","name":"Sensor Port 5","pin":18,"equipment":"","reverse":false,"driver":"rpi"},{"id":"6","name":"Sensor Port 6","pin":15,"equipment":"","reverse":false,"driver":"rpi"}]

My inlet is 4 but the below page does not load.
http://{ip_of_your_reef_pi}/api/inlets/{id_of_your_inlet}/read

1 Like

Version 0.2.2 (beta): ATO support is ready for testing. You can install it with HACS, choose “show beta versions”:

Deleted ……

Awesome Thanks. Will test it out and let you know.

1 Like

Thank you so much @RedViper I can confirm my automations work correctly as well.
Now to create Feed Mode Scene …

The ATO Sensor Last Run seems to reset every couple of minutes, I think it’s showing the last time ATO Sensor was polled by reef-pi and adding about a minute reporting delay. This is not the last time the ATO pump was activated. Sensor Duration also remains more or less at zero. Either way it’s good to see that reef-pi is checking periodically.

Return OFF Automation

  alias: 40B Return Off
  description: 40B Return Off
  trigger:
  - platform: state
    entity_id: switch.reef_pi_pb1_2_return
    from: 'on'
    to: 'off'
  condition: []
  action:
  - service: switch.turn_off
    target:
      entity_id: switch.reef_pi_ato_sensor_enabled
  - service: switch.turn_off
    target:
      entity_id: switch.reef_pi_pb1_6_skimmer
  mode: single

Return Pump ON Automation

  alias: 40B Return On
  description: ''
  trigger:
  - platform: state
    entity_id: switch.reef_pi_pb1_2_return
    from: 'off'
    to: 'on'
  condition: []
  action:
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - service: switch.turn_on
    target:
      entity_id: switch.reef_pi_pb1_6_skimmer
  - delay:
      hours: 0
      minutes: 15
      seconds: 0
      milliseconds: 0
  - service: switch.turn_on
    target:
      entity_id: switch.reef_pi_ato_sensor_enabled
  mode: single
1 Like

I’ve published the version 0.2.3 - it should fix the issue with resets of ATO last run and duration and actually show real values.

I am getting the following error after update.

I’ll try removing the integrations and re-add as I have been doing previously, rather than update through HACS.

I was not able to reproduce the crash, but tried to fix it in the 0.2.4.
Let me know if it still reproduces.

Updated but the two entities not coming through.

I am also getting an error on reef pi dashboard stating stats for ID 9 not found.

I recall earlier in the API altos it was stated at ID 9.

So that could be the problem?

Problem fixed it was reef-pi not showing stats for the ATO.

1 Like

Hi! very nice integration! I’m testing right now version 0.2.4
What is the refresh rate for the stauts on Home Assistant? If I turn on any device on Reef-pi it took nearly 60second to show up on home assistant…

Hi,

The polling interval is 1 minute: reef-pi-hass-custom/const.py at f0d05bf58610f96a5cba2724679e020c87b8900b · tdragon/reef-pi-hass-custom · GitHub

I am planning to add support for mqtt to get real-time updates, but did not implemented it yet.
MQTT in reef-pi is not very friendly for Home Assistant.

My ATO using MQTT to get my optical sensor status was working fine for the most part until a few months ago. For some reason I am getting MQTT errors in reef-pi and HA and havn’t been able to resolve them. But I saw that there is now ATO support in the integration. I don’t fully understand the reasoning behind the 3 values though. I understand the enable but what is the purpose of the duration and last run. My last run history shows that it is cycling roughly every 4 mins and lasting about 1 min. There are a few longer periods. But I can’t determine why it is changing. It is not affected by the sensor. The duration shows 15 except for a roughly 40 hour period where it showed 0. I was thinking it was the check frequency but that has not changed and when I did manually change it, there was no change in HA.

My use of the optical sensor is used to turn on a valve in my basement to add water on my main level. Is it possible for the integration to know if the sensor is detecting water or not? With MQTT I was getting a 0 or 1 depending on the state before it stopped working.

The integration is polling Reef-Pi periodically, so it cannot reflect ATO state in real time.
Therefore it gets a timestamp of the last time when ATO detected water and the duration while pump were running. This is how Reef-Pi reports ATO statistics.

MQTT is better for real time notifications. The last version of ReefPi had some changes in MQTT configuration. It is possible now to specify “Topic Prefix” to be used for telemetry. Did you check them?

I ended up getting it working after playing around for a little while. I found that I was getting errors in HA and Reef-Pi stating that the broker was not available(or something similar). I ended up removing the MQTT integration and removed the MQTT Broker addon and reinstalled them both. Worked after that with no changes made to Reef-PI. I’m guessing there was an issues during an upgrade of HA at some point causing the failure. But all is working now. Thanks.

@RedViper thank you again for your amazing integration!
would it be possible to also controls lights and macro?
I’m thinking about doing some automation for power outage to reduce return pump speed, reduce lights intensity to add more battery life to my UPS.
Thank you very much!
Simone

Yes, I’ll look what I can do with lights and macro.
I am not using them myself, so if you have ideas how the integration should look like your ideas are welcome:)

Thank you for the quick reply!
I think they can be simple entity with intensity control capabilities for light… The perfect solution will be something like the fan component, with pwm step…
But we need to try it out :slight_smile: