SmartThings Pool Controller
This is my first device handler for SmartThings
I wanted to create a pool controller for switching modes in our pool and will eventually add the vacuum and other items in later. Hopefully this will either help someone along that is looking to do similar or give you just what you need.
Right now I do not have any valves I’m running the testing with a bread board and lighting up some LEDs. This is working great and the google assistant integration through IFTTT is a nice have.
This project requires stretch OS on Raspberry Pi.
WEBIOPI setup on the RPi. http://webiopi.trouch.com/
In WEBIOPI I set the startup config file to enable the GPIO’s I’m using to output so each time the RPi starts up the GPIO’s will be accessible. You can change the GPIO’s or use the same in the Python scripts.
The Pool Controller works like this, when you click to change a mode it will turn off the pump before turning any valves as this is safer with my pump configuration. After the pump is off the modes will start changing and you will see the current mode turning off and the new mode turning on. There is a 10 second delay added when changing modes so the valves have enough time to turn.
If you click restart it will make a call to the RPi to reboot and display rebooting under the RPi symbol.
There are also various monitors to keep track of CPU, disk space usage, memory and CPU temp.
Google Assistant Integration:
To integrate with Google Assistant you will need to create a piston in WebCore and create an IFTTT recipe that calls the piston. The recipe uses Google Assistant and WebHook.
The Google Assistant file on GitHub shows the url that you append to the external piston url in order for IFTTT to make the call to your piston with the proper parameters.
Within IFTTT you create a recipe that uses google assistant. You can set it to what ever command you would like to speak.
Then just add a webhook to the same recipe that calls the external piston url and passes the parameters in.
You can get the external url for a piston as in the screenshot below