Apex and Home Assistant RO Automation

deutchriffer

Community Member
View Badges
Joined
Jul 15, 2024
Messages
53
Reaction score
9
Location
Germany
Rating - 0%
0   0   0
Wondering if someone can tell me where I’m going wrong.

I have a virtual Apex Outlet that triggers an automation on Home Assistant, I have the outlet set to Auto in ApexFusion and seem to have the trigger working when ATO_LO is OPEN, it starts my HA automation which is attached below

What I’m trying to do, is when the ATO is low then turn on the RO system with a pre-flush and run for a max of 20min and a post-membrane flush, then shut off.

What is happening is, the automation is triggered, then a few seconds later my Apex switches the outlet OFF, not remaining on Auto then moving to the Auto-OFF, just off.

I can’t see what I might be doing wrong here, I would assume that it wouldn’t be the apex coding that is turning the outlet completely off, but not sure if my HA automation is causing it.

Original:
Fallback OFF
Set OFF
If ATO_LO OPEN Then ON
If ATO_HI CLOSED Then OFF
When On > 025:00 Then OFF
Defer 000:30 Then ON
Defer 000:30 Then OFF

Updated:
Fallback OFF
If ATO_LO OPEN Then ON
If ATO_HI CLOSED Then OFF
When On > 025:00 Then OFF
Defer 000:30 Then ON
Defer 000:30 Then OFF

IMG_6432.jpeg IMG_6433.jpeg IMG_6434.jpeg IMG_6435.jpeg
 

Formulator

Valuable Member
View Badges
Joined
Apr 14, 2024
Messages
2,481
Reaction score
2,585
Location
Saint Louis, MO, USA
Rating - 0%
0   0   0
The only thing in the apex code that will turn the outlet completely to the off position is the “When On … Then Off” command. Yours looks right if you want it to shut off if it runs more than 25 minutes. I have the same code for my ATO. It shuts completely off as a safety so I know to investigate the problem and have to manually turn the outlet back to the auto position.
 
OP
OP
D

deutchriffer

Community Member
View Badges
Joined
Jul 15, 2024
Messages
53
Reaction score
9
Location
Germany
Rating - 0%
0   0   0
not long after posting this I was thinking to myself, the one bit of code I’ve never used elsewhere is this when on command. I figure with notifications from HA, a high and low optical sensor, a float, a pressure switch for the RO Booster, I might just need to come to terms with losing the one bit of code that gives me the quintet of redundancy thanks for sharing your thoughts.

Do you also use V outlets to do your flushing and whatnot? If so would love to see your codes
 

slythy

Well-Known Member
View Badges
Joined
Aug 3, 2021
Messages
911
Reaction score
822
Location
USA
Rating - 100%
1   0   0
I have always been weary of the solenoids leaking and being connected to an infinite supply of water.

Which solenoids do you use? I just use 3 valves, 1 through the ceiling to my ATO, one through the wall to my mixing station and 1 to an open line. I just turn it on and ball valves turn it off.
 

Attachments

  • IMG_7507.jpeg
    IMG_7507.jpeg
    207.4 KB · Views: 27

Formulator

Valuable Member
View Badges
Joined
Apr 14, 2024
Messages
2,481
Reaction score
2,585
Location
Saint Louis, MO, USA
Rating - 0%
0   0   0
not long after posting this I was thinking to myself, the one bit of code I’ve never used elsewhere is this when on command. I figure with notifications from HA, a high and low optical sensor, a float, a pressure switch for the RO Booster, I might just need to come to terms with losing the one bit of code that gives me the quintet of redundancy thanks for sharing your thoughts.

Do you also use V outlets to do your flushing and whatnot? If so would love to see your codes
I have an Avast Parrot ATO connected to Apex, but similar principal to what you are doing. I have a liquid level sensor in my ATO reservoir named “LLS_FW”, so my code will shut off the pump if the water level is less than 4 inches in my reservoir. A separate outlet connected to a solenoid on my RODI system will open the solenoid when the reservoir gets below 5 inches.

Here is my code for the outlet connected to my ATO pump (I used a feed button for manual control in case I just want to collect some RODI water from a separate faucet with a manual valve):

Fallback OFF
Set OFF
If Parrot CLOSED Then ON
If LLS_FW < 4.0 Then OFF
When On > 010:00 Then OFF
Defer 000:04 Then OFF
Defer 001:00 Then ON
Min Time 030:00 Then OFF
If FeedB 000 Then ON

And here is the code for the solenoid on the RODI output going to my reservoir:

Fallback OFF
If LLS_FW < 5.0 Then ON
If LLS_FW > 9.7 Then OFF

Here is a schematic of my system (ignore the salt mixing station as I haven’t actually set that up yet):
IMG_4878.jpeg
 
OP
OP
D

deutchriffer

Community Member
View Badges
Joined
Jul 15, 2024
Messages
53
Reaction score
9
Location
Germany
Rating - 0%
0   0   0
I have always been weary of the solenoids leaking and being connected to an infinite supply of water.

Which solenoids do you use? I just use 3 valves, 1 through the ceiling to my ATO, one through the wall to my mixing station and 1 to an open line. I just turn it on and ball valves turn it off.
My problem is have the water supply under my house toward the front of the house, and then I’m running that under, and then out and around and back into my fish room.

I’m running my setup with normally closed solenoids so my theory is they will likely fail in the off position than the on position (please don’t tell me how naive I am as I’m pretty sure Santa is still real)

I run this via a Sonoff 4CH Pro R3 that I have connected to home assistant, I have the following solenoids:
1 on the supply feed to the RO
1 to do the membrane flush
1 to do the output to my tank

The pump has a back pressure shut off to kill power to it and my automations and gravity essentially allow the output to my tank to completely drain itself after each use.

In the future I’m thinking I might run it to a water storage tank like a slim line caravan/camping tub and then have a pump like the new tunze that has huge head height potential and feed it off that, but for the moment I’ve taken this approach.

The other bits in there was my attempt at making a TDS device that could integrate into HA and for the most part it does but I’m not sure how accurately it can detect 000-001ppm, and having it in the enclosure with the pumps PSU is likely going to cause all sorts of interference, so it was just a waste of time but learnt a lot with it, I think next time I’d use an arduino instead of esp32
 

Attachments

  • image.png
    image.png
    1.2 MB · Views: 27
  • JPEG image-4616-BF23-5C-0.jpeg
    JPEG image-4616-BF23-5C-0.jpeg
    74.8 KB · Views: 26
  • JPEG image-455A-B0A4-2C-0.jpeg
    JPEG image-455A-B0A4-2C-0.jpeg
    185.1 KB · Views: 22
  • IMG_6436.jpeg
    IMG_6436.jpeg
    191.9 KB · Views: 25
  • IMG_5910.jpeg
    IMG_5910.jpeg
    137 KB · Views: 27
OP
OP
D

deutchriffer

Community Member
View Badges
Joined
Jul 15, 2024
Messages
53
Reaction score
9
Location
Germany
Rating - 0%
0   0   0
I have an Avast Parrot ATO connected to Apex, but similar principal to what you are doing. I have a liquid level sensor in my ATO reservoir named “LLS_FW”, so my code will shut off the pump if the water level is less than 4 inches in my reservoir. A separate outlet connected to a solenoid on my RODI system will open the solenoid when the reservoir gets below 5 inches.

Here is my code for the outlet connected to my ATO pump (I used a feed button for manual control in case I just want to collect some RODI water from a separate faucet with a manual valve):

Fallback OFF
Set OFF
If Parrot CLOSED Then ON
If LLS_FW < 4.0 Then OFF
When On > 010:00 Then OFF
Defer 000:04 Then OFF
Defer 001:00 Then ON
Min Time 030:00 Then OFF
If FeedB 000 Then ON

And here is the code for the solenoid on the RODI output going to my reservoir:

Fallback OFF
If LLS_FW < 5.0 Then ON
If LLS_FW > 9.7 Then OFF

Here is a schematic of my system (ignore the salt mixing station as I haven’t actually set that up yet):
IMG_4878.jpeg
thanks for sharing I’m assuming the numbers are because you’re using those rod level sensors? Heard mixed feelings on those because they’re essentially like those plant moisture sensors that end up corroding over time but likely shouldn’t in rodi water given the purity?

What did you draw your design up in as I struggled to do something similar when planning out these things and would like to use in future
 

Formulator

Valuable Member
View Badges
Joined
Apr 14, 2024
Messages
2,481
Reaction score
2,585
Location
Saint Louis, MO, USA
Rating - 0%
0   0   0
thanks for sharing I’m assuming the numbers are because you’re using those rod level sensors? Heard mixed feelings on those because they’re essentially like those plant moisture sensors that end up corroding over time but likely shouldn’t in rodi water given the purity?
Yes I’m using the Neptune liquid level sensor. Time will tell, but so far I haven’t had any issues and I really like the functionality. It helps me track my water usage better than single point optical sensors. It has been in use about 4 months now.

What did you draw your design up in as I struggled to do something similar when planning out these things and would like to use in future
I just used microsoft powerpoint. For simple designs that don’t need scale, I find it the fastest and most intuitive. Just use shapes and arrows. I do manufacturing process design at work and even use powerpoint for the simple stuff there.
 
OP
OP
D

deutchriffer

Community Member
View Badges
Joined
Jul 15, 2024
Messages
53
Reaction score
9
Location
Germany
Rating - 0%
0   0   0
I have an Avast Parrot ATO connected to Apex, but similar principal to what you are doing. I have a liquid level sensor in my ATO reservoir named “LLS_FW”, so my code will shut off the pump if the water level is less than 4 inches in my reservoir. A separate outlet connected to a solenoid on my RODI system will open the solenoid when the reservoir gets below 5 inches.

Here is my code for the outlet connected to my ATO pump (I used a feed button for manual control in case I just want to collect some RODI water from a separate faucet with a manual valve):

Fallback OFF
Set OFF
If Parrot CLOSED Then ON
If LLS_FW < 4.0 Then OFF
When On > 010:00 Then OFF
Defer 000:04 Then OFF
Defer 001:00 Then ON
Min Time 030:00 Then OFF
If FeedB 000 Then ON

And here is the code for the solenoid on the RODI output going to my reservoir:

Fallback OFF
If LLS_FW < 5.0 Then ON
If LLS_FW > 9.7 Then OFF

Here is a schematic of my system (ignore the salt mixing station as I haven’t actually set that up yet):
IMG_4878.jpeg
How do you get your device to switch back to Auto or ON when it does the “when on then off”?
 

Formulator

Valuable Member
View Badges
Joined
Apr 14, 2024
Messages
2,481
Reaction score
2,585
Location
Saint Louis, MO, USA
Rating - 0%
0   0   0
How do you get your device to switch back to Auto or ON when it does the “when on then off”?
Just manually flip the slider back to auto. The point of that piece of code is to alert me to an issue since if the ATO runs longer than a few minutes, there is something very wrong. So I want to go investigate and fix that problem before any automation happens. Once the problem is solved, I flip the switch in the Fusion app back to auto.

Note - if you haven’t used the slider bars in the app, there is a virtual safety cover you have to swipe over first, then you can move the switch between off/auto/on states.

IMG_4881.jpeg



IMG_4882.jpeg
 
OP
OP
D

deutchriffer

Community Member
View Badges
Joined
Jul 15, 2024
Messages
53
Reaction score
9
Location
Germany
Rating - 0%
0   0   0
Thanks, I guess I was using that as my reset button but it’s more of a emergency function, I’ll set that longer than I anticipating it takes to run and still keep it as an emergency shut off but my aim is to have it automated without needing to manually set anything back
 

Formulator

Valuable Member
View Badges
Joined
Apr 14, 2024
Messages
2,481
Reaction score
2,585
Location
Saint Louis, MO, USA
Rating - 0%
0   0   0
Thanks, I guess I was using that as my reset button but it’s more of a emergency function, I’ll set that longer than I anticipating it takes to run and still keep it as an emergency shut off but my aim is to have it automated without needing to manually set anything back
the “If … then” statements with your sensors will make it automated. It will always stay on auto and switch on/off. You only have to manually turn back on if the “when … then” statement becomes true.
 
Last edited:

Formulator

Valuable Member
View Badges
Joined
Apr 14, 2024
Messages
2,481
Reaction score
2,585
Location
Saint Louis, MO, USA
Rating - 0%
0   0   0
My problem is have the water supply under my house toward the front of the house, and then I’m running that under, and then out and around and back into my fish room.
Why is your RODI under your house? LOL. That seems like an easy fix…
 
OP
OP
D

deutchriffer

Community Member
View Badges
Joined
Jul 15, 2024
Messages
53
Reaction score
9
Location
Germany
Rating - 0%
0   0   0
Why not? It’s out of sight and out of mind, gets spousal approval and sits in a place where not much else can go, might even grab a couple storage tanks and have my SW mixing station there.

Unlike US we don’t have basements or similar to be able to house a lot of the ugly gear that comes with a reef tank.

Since getting rid of that single line of code “When ON..” everything’s been great so pretty much sorted for now until I decide to add more to the equation, thanks again for that.
 
OP
OP
D

deutchriffer

Community Member
View Badges
Joined
Jul 15, 2024
Messages
53
Reaction score
9
Location
Germany
Rating - 0%
0   0   0
Lowest would be 0 Celsius but winters usually 3-6 Celsius overnight, summers 30-40 Celsius
 

HAVE YOU EVER KEPT A RARE/UNCOMMON FISH, CORAL, OR INVERT? SHOW IT OFF IN THE THREAD!

  • Yes!

    Votes: 32 45.7%
  • Not yet, but I have one that I want to buy in mind!

    Votes: 9 12.9%
  • No.

    Votes: 26 37.1%
  • Other (please explain).

    Votes: 3 4.3%
Back
Top