This project provides a simple REST API server and multiple REST client implementations for IoT light system control. Compared to websockets or MQTT, such an architecture uniquely allows huge diversity for the type of clients allowed. The endpoints can be manipulated via Siri shortcuts, Google Home, Alexa, Chrome extensions and command line, among others.
- PostgreSQL - backend database
- Python/Flask - RESTful handler
- IFTTT - Intermediate webhook handler for Google Home and Alexa clients
- NodeMCU ESP8266 WiFi SoC - hardware implementation for servo control
- C++ - ESP8266 client implementation
- Javascript - Chrome extension client implementation
The hardware implementation requires a servo motor with least 2.5 kg-cm torque and a NodeMCU ESP8266 development board or similar (any WiFi-capable board should suffice but will require alteration to pinouts and WiFi connection code)
- Clone the repo
git clone https://github.com/rpraka/lightsapi.git
- Reserve a Heroku dyno or any other VPS instance. Deployment is easiest with Heroku as all required files have been provided. Attach a postgreSQL instance.
- Set the following parameters in the code as desired:
- WIFI SSID and password
- Device ids and authkeys
- Base url endpoint of the VPS server
- Deploy the server code to the VPS
- Install hardware implementation
- Enable your choice of client implementations
- Could add more advanced auth features, but is likely just uneccessary overhead in this case.
- Considered websocket rather than REST, but probably is overkill for an ESP8266. MQTT might be a better choice, but is harder to interface with commercial smart home devices.
Any contributions are greatly appreciated.
- Fork the Project
- Create a Feature Branch (
git checkout -b feature/example_feature
) - Commit your Changes (
git commit -m 'Added example_feature'
) - Push to the Branch (
git push origin feature/example_feature
) - Open a Pull Request
Distributed under the MIT License.
- See in-line comments