aakash jaiswal
Published

WhatsApp controlled Home automation

Control your home light with whatsapp from anywhere in the world

IntermediateFull instructions provided1,281
WhatsApp controlled Home automation

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
single channel relay
×1

Software apps and online services

Twilio API for WhatsApp
Twilio API for WhatsApp

Story

Read more

Schematics

connection_UV7KhL2m0b.png

Code

coding.ino

Arduino
#include <ESP8266WiFi.h>
#include <ThingESP.h>



ThingESP8266 thing("technicalaj", "nodemcuwhatsapp", "987654");

int LED = D1;

unsigned long previousMillis = 0;
const long INTERVAL = 6000;  

void setup()
{
  Serial.begin(115200);
  pinMode(LED, OUTPUT);
  thing.SetWiFi("TR","12345678");
  thing.initDevice();
}


String HandleResponse(String query)
{
  if (query == "led on") {
    digitalWrite(LED, 1);
    return "Done: LED Turned ON";
  }

  else if (query == "led off") {
    digitalWrite(LED, 0);
    return "Done: LED Turned OFF";
  }

  else if (query == "led status")
    return digitalRead(LED) ? "LED is OFF" : "LED is ON";
  else return "Your command invalid..";

}


void loop()
{
  thing.Handle();

}

Credits

aakash jaiswal
17 projects • 26 followers

Comments