Recently I decided it was time to give my lawn a makeover. Years of brutally hot Atlanta summers have taken their toll on my grass and its well … dead. I chose the do it yourself route and as usual went over budget and invested far more time than I had planned. None the less I now have a decent looking backyard.

Given my investment and how much I travel I decided it would be worth the extra money to install an automated sprinkler system. There are several of these that exist in the market so I set out doing my research. I chose Rachio (http://rachio.com) for its ability to control watering based on weather and other conditions which is awesome! While Rachio is a great product with several features it had a few shortcomings that I was hoping to supplement with my existing home setup (powered by Apache NiFi of course). The idea was the use all of the existing features that Rachio offered and then use data from my local home automation setup to further supplement the watering system. There were two main features that Rachio didn’t offer that I wanted to add.

Dog (Zeke) Location - My wife and I have the world’s coolest dog (Zeke). He does have a few weaknesses however and water happens to be one of them. Since he spends much of his time in the fenced in backyard by himself I can’t risk them turning on while he is back there or he will enter hyper puppy play mode and dig them all up. Worse yet he will bring that mud back in the house with him once he is done. It is a must that my the system understand when he is outside and not allow watering to occur.

- My wife and I have the world’s coolest dog (Zeke). He does have a few weaknesses however and water happens to be one of them. Since he spends much of his time in the fenced in backyard by himself I can’t risk them turning on while he is back there or he will enter hyper puppy play mode and dig them all up. Worse yet he will bring that mud back in the house with him once he is done. It is a must that my the system understand when he is outside and not allow watering to occur. Outdoor Gatherings - We use our backyard a lot and don’t want unexpected waterings while we have guests in the backyard. While Rachio allows you to manually control this with an app I wanted a more automated approach that understood when we were in the backyard without any manual process.

After settling on the features that I wanted to my system I set out to solve the technical implementation and landed on the approaches listed below.

Dog (Zeke) Location - This problem was a little tough to solve. I finally landed on installing an iBeacon (Gimbal Series 10) on Zeke’s collar and setting up a custom Raspberry PI BLE scanner that I had made for another project. This is out of the scope of this blog but at a high level the scanner sits at his only entrance/exit to the yard and toggles between him being either inside of outside. This is c++ and python application that uses Linux bluez. An instance of Apache NiFi is also running on this Raspberry PI and forwarding the JSON iBeacon payload to my NiFi master cluster for further analysis.

Outdoor Gatherings - Similar to tracking Zeke with his iBeacon collar I have a separate wireless network in my backyard and uses a MikroTik RouterOS software to monitor for MAC addresses of friends and family’s mobile phones. The logic is if a known MAC address is connected to that network in the backyard then someone is back there and we should delay the sprinklers being turned on. Another instance of Apache NiFi is gathering output from RouterOS and sending that information the the main NiFi instance for further analysis.

To recap I have three instances of Apache NiFi running. Two instances are gathering data from its point of inception and passing that data along to the third instance where the data is analyzed. This instance also sends requests to the Rachio API to turn off the watering system if a dog or human being is detected in the backyard. Lets take a look at the NiFi workflow of the third instance that ultimately controls the water system.

The workflow was created with out of the box features and simple steps to follow. Clearly Apache NiFi is the cadillac of integrating with other awesome 3rd party systems!