Automated Pool Controller [NEEDS UPDATING: ALL GROOVY CODE IS OBSOLETE]

Smartthings receiving the reply as in the return part of the particle function changes the switch status’s. The logic is say for example you turn the pool light off it sends off the request. If it couldn’t talk to the photon it won’t change it switches right back. You could test that theory by installing the device handler and not giving it the right access keys when you turn a switch on it will just switch right back since it’s not working. In the device handler it gets the photons reply to the request. It doesn’t really sort out what the reply was but just that it got one. It assumes that if it got the reply that the photon successfully receives the request and it changes the switch status in smartthings. For some of the other data example rpm it goes and grabs the particle variables through a refresh and I often did use the particle publish along with webhooks to webcore to accomplish that task. I hope this helps.

So, If I’m reading this correctly if I had a tile in the device handler that made a rest call to my raspberry then the handler would look for a response from that call and change the status of the tile?

So a couple of notes with the project. The etape water sensor has been stellar. I wish it is the method I had first used for water level sensing. I have migrated the chemical pump and chemical sensing over to my dedicated unit. The ph sensing and automatic chemical control based on that sensed value has been stellar. Orp does wander as others have reported and I wasn’t using it to automatically dispense but I have found it works good as a trigger or warning. I notice as it drops below a certain value that if I test the water I would come up low as expected and as long as I’m on a certain range I realize I’m close to where I’m supposed to be. So this is all I will probably use it for. I got my non contact liquid level sensors installed and those were working great. While messing with something especially since I didn’t have any sort of protections against this I noticed that I accidentally shorted my cuircuit board on something. I noticed cause the photons flashed and rebooted. Oops after this short my liquid level sensors aren’t returning any values and ph went really wonky always returning a full five volts when tested with a militia meter. I figured I fried the phidgets ph board. I removed the orp sensor and switched the orp board to ph mode and I was back in business for ph. I’m just glad I didn’t screw up the ph probe but I’ll have order a replacement board and sensors. To protect against this in the future. I just added a 3D printer into my tools and printed some mounts and bumpers for the electronics. So far I’m very happy with the dedicated chemical sensor other than the minor speed bump.

image

Correct. I’m not sure how to directly transfer that over to raspberry pi. However I’m sure you could figure it out. I think there lots of smartthings examples talking to the raspberry pi out there that might even better methods or examples of how to communicate with it that you could adopt over to this pool project.

I have a raspberry pi that I’ve been communicating with hubitat that uses http calls to a simple flask server running on the pi to do certain actions. Maybe I’m sure that’s something that could be mirrored with smartthings and your pi. Other projects I’ve seen using telnet or tcp. Another option is I believe you can run particle software on a raspberry pi so that you have access to the particle cloud platform and could program it the same way.

@bscuderi13 sorry if I missed it, but what are you using to determine levels in your chemical tanks? I currently have a prototype running a VL53L0X ToF Laser Ranging Sensor, but I haven’t actually deployed it in the chlorine tank, and I’m not sure how to keep it protected.

Also, how is your flow cell working out? Having high pressure running through 1/4" flex tube scares me a bit lol.

Yeah that’s the problem with all those types of solitons. I’m sure the fumes inside that tank will kill and corrode that thing so fast assuming you find a way to get it in there haha. Because of this I’m using a non contact liquid level sensor. So it goes on the outside of the tank as you can see in the picture and doesn’t give me an exact level but triggers to send me notifications of the fluid falls below that level. Search non contact liquid level sensor on amazon and you’ll see the ones I used that are in that photo. I believe they use capacitance. As far as the flow cell it’s great that’s exactly how the commercial ones operate. They just aren’t pvc haha but the tubing part is the same they use. Honestly it’s not subject to that high of pressure maybe 28 psi max with the floor cleaners running… I think the home water supplies are more than that if I’m not mistaken. You could always use thicker tubing they make stuff that withstands some pretty ridiculous pressures. I have some tubing that does high pressure gas for homebrewing. And I’m sure this cheap stuff on the pool does at least a couple hundred psi and it’s nowhere ever near that. The tubing on the stunner pumps gets much much more pressure.

Nice progress! A couple questions…is the newly posted picture of the interface a hubitat implementation? And what software are you running to design your 3D parts?

I think I agree with you about the pressures…they really aren’t that high. But be careful about the clear tubing, I’m sure you know it’s not UV resistant and degrades…I’ve read a number of people have had those leak within a year…but your implementation does not look to get full sun, so maybe ok. Mine came with the clear and I am planning to replace before next summer.

About the etape, I will get the Teflon jacketed one and have decided to mount the “head” outside on the top. I really want to know the level on my chlorine, haha.

1 Like

Well the 3D printed parts came from thingsverse. I wish I was good enough to design my own but I did just get the printer like last week lol. I just searched the relay board and proto boards I used to solder my compontents to by model number on thingsverse and found multiple designs already made. I want to learn to design cause I’d love to make a mount to hold my “flow cell” to the wall since I currently have it just set on top of the electrical box… which I know probably isn’t the best place for it haha. It doesn’t leak now but I need to get it don from there before it ever does. As far as the etape I am using the chemical one in my pool for the level and I’d love to see how that turns out for you after a bit in the chlorine tank. hahah but I’ll let you take that gamble first. The interface is the native built in hubitat dashboard app so that’s a dashboard I made to be able to quickly view the pools parameters. As far as the tubing I have already seen the tubing for the chemicals crack in a couple places and spit pinhole leaks that I have cutout and replaced the tubing with the excess I had laying around… I wasn’t sure if it was uv or normal chemical wear and tear. Sound a like I need to just replace my tubing do you have any you could link that you would recommend. I have no qualms about replacing all that tubing to prevent problems.

There is the stenner page that shows the 2 types of tubing…looks like this page shows some 3/8”…here is what I am planning to order eventually

Which data wires on the pump did you hook to the Photon to get the pump data?

My version just uses a table of known values based on say setting the pump rpm to 3450 and reading the watt data once it stabilizes. The display on mine showing 3450 rpm and x watts is just basically saying the photon has the relays activated that would result in that power setting and RPM. @Jonpcar has been working on a version that directly talks to the pump. His hooks up to the rs485 jack on the pump via an adapter to the photon. He links his progress in some of the recent comments above.

My son-in-law is coming to town so I started looking at the front end where I am hoping to get some help from him.

hassio: It seems that there is really no precedent for using Particle.io’s native photon cloud functions (variable, function, publish, subscribe) to interface to hassio. There is a bit of talk about it, a couple people have successfully used mqtt, which seems to me to be an alternative to using Particle’s directly supported cloud functions. One user claims success at a photon implementation but there is little indication on how that success was obtained.

On the other hand, I also started looking at Hubitat. Brennon, it seems that you must be one of the the trailblazers on that site for Photons. Very few mentions of Particle.io and the photon but more than on the hassio site. Once again some of those discussions involve mqtt. The most promising thread is this one:

My understanding of all this stuff is very low at the moment and I am trying to get a handle on it before I involve my brilliant son-in-law. So Brennon, are you using native Particle.io functions/calls to interface with Hubitat? That to me would be a big advantage over using the mqtt approach (or is even my primal understanding of this issue way off base?)

Currently, I have zero smart home gadgets/implementations so I am starting from a blank state on this side of it and trying to decide how to move forward.

Yeah I am using the native particle function calls. I haven’t seen that thread on hubitat. But I’ll have to visit it and see if What in have so far if it’s helpful to that community. I actually was successful 3 different ways of interfacing to the hubitat and the photon.

  1. My device driver makes calls to the particle cloud to call functions. This is a good way to control relays etc. to receive data I have success with both receiving particle variables from the the cloud and the photon sending sensor data direct to hubitat through the maker api. I like the latter cause it’s automatic and has far less jumps.

  2. I experimented with myqtt and had that way working as well using a raspberry pi I have on my network as the server.

  3. I also experimented with running an http client on the photon itself and you can make http requests to the photon to control devices. The only con here is the added complexity and resource use running the server on the photon. It would be however 100 percent local.

For now I have fallen on option one. I use the particle cloud to call functions execute relays etc. However all sensors send their data to hubitat locally over my network via the hubitat maker api. This takes needless cloud hops refresh rules etc out of the equation. To display my data I’m just using the native hubitat dashboard. However there are other options.

I can post the code as well as examples for my hubitat drivers. If that is helpful.

If you use node red in hassio, the graphical equivalent of WebCoRE, it is able to integrate directly with the particle cloud and does so graphically, so it’s very easy to make interactions. Node Red alone is worth the cost of entry for HA in my opinion. MQTT also works well within HA(and links directly to SmartThings with a little effort). It can run directly in the Pi running Hassio (as can node red as they’re all simply add-ons)…

Is your GitHub repository updated with your latest ino code?

My github I’ve been bad about updating. I’ll Get in there and update it. I’ve made lots of enhancements to how connections and drop connections are handled as well as added the differences to send data to hubitat as well as smartthings. I’ll let you know when I put new .ino in there. Just use caution and probably save a backup copy of the one you were using before just in case. Like if you were using that same old pool light as I was. My light died and I bought the same light but it was a new version or something and it handled color changes differently. I consolidated the code and made it handle the new logic so if you were using that it might break that for you but I’ll post it so you can pick through parts you want if nothing else. Might take me a minute cause I’ll have to go in and de-identify some info since I programmed it to talk to my hubitat directly.

Guys, thanks for the feedback! Brennon, I really appreciate the feedback and the documentation that you have made available to everyone. I don’t want to make work for you regarding sharing your hubitat files as I am not ready to make the plunge (I would have to buy the hub first, haha). Lance, I do have a raspberry pi sitting around and installed hass.io on it, but even there I am not ready to make the time/learning commitment as I am still working at the Photon level functionality and planning out my pool hardware.

Instead I have punted my front-end decision out to a later date. My son-in-law spent a few hours with me last night and he implemented some hooks that allow me to access all the Photon’s cloud functions (except Subscribe, which I am not using) through google sheets. I’ll make a rudimentary dashboard there and monitor all my data (and data history) through it. It will also send my function calls to the Photon for override requests (start waterfall, change pump, turn on lights, etc). I’ll be pushing out (publish) all my pool data (status, temps, pressures, chlorine doses, eventually ph readings, etc) to the spreadsheet directly where I’ll have to figure out what I want to do with it.

I can access google spreadsheets from anywhere (when I’m travelling) so I’ll be able to remotely monitor the pool status which was one of my original goals. The user interface will not be as pretty as hubitat/home assistant but I can live with that for a time while I continue to bring up my system.

It’s going to take me some time to figure out exactly what my son-in-law did as I have never worked with google sheets, webhooks, triggers, javascript, etc. But for now I have system that will allow me to move forward and not necessarily require me to fully understand the underlying mechanisms.

I DID (embarrassingly) discover that I have not been even close to using the Photon’s full potential as I was not even aware of the tools on the Particle site (webhooks, device status/command menu). I’ve been struggling through with command prompts from a windows console and the desktop IDE compiler/uploader. I learned a LOT in those few hours!

This stuff is a LOT of fun! Merry Christmas everyone!

1 Like

If all you need is a not very aesthetic but simple form of control and monitoring the pool even from away why not just download the particle app to your phone and use that?