Wow, I have a new Home Automation project to implement...let's do it!
Basically the my conditions / requirements are the following:
- I don't want to tweak my gate board, considering my limited knowledge on its circuitry
- I have WIFI network coverage at the gate
- I want to integrate this system with my existing HA webapp (SmartHome)
- Everything should be cheaper of every other existing solutions
- Bonus point: I would like to also use Siri on my iPhone and say "Hey Siri, open the gate"
Given the previous points, the first idea came to my mind is to use the existing remote I have and control its activation using a relay, driven by a tiny Raspberry PI Zero W (yes, W stands for wireless, cool!). Activating a relay with a Raspberry PI is quite straightforward using Python and you can find a lot of tutorials on the internet. The only part that requires a bit of effort is soldering the cables to bring out the battery from the remote in order to enable it using the relay. The gate button can be easy blocked on pushed position using a nylon cable tie.
Once you are able to toggle the relay, you can expose this operation using Python Flask web framework and you can integrate the API in your HA platform. In my case I can open the gate using the following shell command:
curl -X POST localhost:5000/toggle-relay?delay=1
As you can see I also added the delay parameter to control the duration of the relay activation (see the code here).
At this point the project is almost complete but, wait, we have the bonus point, I want it :) After googling a bit I've found the promising HomeBridge project. Essentially it allows you integrate whatever device you want with iOS HomeKit. I've looked a bit at the code and writing a custom accessory / platform is really easy, in my case, apart the boilerplate code, it's less than 10 lines of JS (see the code here)!
You can build this smart gate opener with less than 10 euros (price doesn't include the remote and its battery cost :D)...very easy and useful project! See you at the next one!

No comments:
Post a Comment