This project made to control ESP8266 by message on Messsenger. You can develop it to control home lights...
Sample:
- web-callback : Chatbot and MQTT communication.
- esp8266 : Code for ESP8266.
- MQTT broker: I suggest Eclipse Mosquitto on Ubuntu.
- Python packages: flask, requests, paho-mqtt.
cd web-callback; pip install -r requirements.txt
- Arduino IDE.
- Pubsubclient library.
- Create a page for your chatbot.
- Go to facebook for developer and create an app.
- Create webhook for your page. It will be the URL of your chatbot. docs1, docs2
- Start mosquitto broker.
You can use ngrok to tunnel your broker.
sudo service start mosquitto
- Change configuration in web-callback.py to match your webhook setting and topic you use to communicate with ESP8266.
- Start chat bot
Or run it in development mode
python3 web-callback.py
export FLASK_ENV=development python3 web_callback.py
- Change configurations in esp8266.ino
- Upload the sketch.