{"id":71352,"date":"2025-03-30T18:12:24","date_gmt":"2025-03-30T22:12:24","guid":{"rendered":"https:\/\/www.engineersgarage.com\/?p=71352"},"modified":"2025-04-20T07:06:47","modified_gmt":"2025-04-20T11:06:47","slug":"whatsapp-based-home-automation","status":"publish","type":"post","link":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/","title":{"rendered":"WhatsApp-based home automation"},"content":{"rendered":"<p>In this article, we will learn how to control our IoT home appliances using the messaging app WhatsApp to easily and effectively communicatie with those devices.<\/p>\n<p>So we will be sending WhatsApp messages to a number of \u201clights on,\u201d and lights at our house will turn ON.<\/p>\n<p><strong>Components required<\/strong><\/p>\n<p><strong><a href=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/Table-1-whatapp-based-home-automation.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-71353\" src=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/Table-1-whatapp-based-home-automation-1024x224.png\" alt=\"\" width=\"740\" height=\"162\" srcset=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/Table-1-whatapp-based-home-automation-1024x224.png 1024w, https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/Table-1-whatapp-based-home-automation-300x66.png 300w, https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/Table-1-whatapp-based-home-automation-768x168.png 768w, https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/Table-1-whatapp-based-home-automation-368x80.png 368w, https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/Table-1-whatapp-based-home-automation.png 1154w\" sizes=\"auto, (max-width: 740px) 100vw, 740px\" \/><\/a>\u00a0<\/strong><strong>Tools Required\/ libraries required:<\/strong><\/p>\n<ul>\n<li>WhatsApp API library &#8211; <a href=\"https:\/\/github.com\/tgalal\/yowsup\">Yowsup<\/a><\/li>\n<li>Python-based Serial communication library &#8211; <a href=\"https:\/\/github.com\/pyserial\/pyserial\">pyserial<\/a><\/li>\n<li>Linux Based machine<\/li>\n<li>Arduino IDE<\/li>\n<\/ul>\n<p><strong>Technical Insights<\/strong><\/p>\n<p>To control anything from the internet, we will need a protocol. WhatsApp works on XMPP (Extensible Messaging and Presence Protocol). We will be using its API to send and receive messages. The received messages will work as commands for a specific task like turning the light ON\/OFF.<\/p>\n<p><strong>\u00a0<\/strong><strong>Block Diagram<\/strong><\/p>\n<div id=\"attachment_71354\" style=\"width: 871px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/xmppwhatsapp.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-71354\" class=\"wp-image-71354 size-full\" src=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/xmppwhatsapp.png\" alt=\"\" width=\"861\" height=\"571\" srcset=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/xmppwhatsapp.png 861w, https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/xmppwhatsapp-300x199.png 300w, https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/xmppwhatsapp-768x509.png 768w, https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/xmppwhatsapp-359x238.png 359w\" sizes=\"auto, (max-width: 861px) 100vw, 861px\" \/><\/a><p id=\"caption-attachment-71354\" class=\"wp-caption-text\">Figure 1 WhatsApp based home automation<\/p><\/div>\n<ul>\n<li>Home appliances are connected with a relay to a microcontroller which controls them when specific ON\/OFF command is received using serial communication.<\/li>\n<li>The microcontroller (Arduino UNO 3 board) is connected to a Linux-based system using serial communication.<\/li>\n<li>A WhatsApp API (Yowsup) is installed in the system with a phone number. Which can send and receive messages from WhatsApp.<\/li>\n<\/ul>\n<p><strong>\u00a0<\/strong><strong>Circuit Diagram<\/strong><\/p>\n<div id=\"attachment_71355\" style=\"width: 686px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/Circuit.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-71355\" class=\"wp-image-71355 size-full\" src=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/Circuit.png\" alt=\"\" width=\"676\" height=\"711\" srcset=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/Circuit.png 676w, https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/Circuit-285x300.png 285w, https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/04\/Circuit-226x238.png 226w\" sizes=\"auto, (max-width: 676px) 100vw, 676px\" \/><\/a><p id=\"caption-attachment-71355\" class=\"wp-caption-text\">Figure 2 LED connected to Arduino Uno<\/p><\/div>\n<p><strong>How the system works?<\/strong><\/p>\n<ul>\n<li>When someone sends a message to the number at which the WhatsApp is installed in the Linux system.<\/li>\n<li>The message is received in the system through a Python script running a message receiving the script and analyzed for commands like \u201cturn lights on\/off\u201d.<\/li>\n<li>When any command is matched with the predefined commands, the script sends that command to the microcontroller connected to the serial communication port.<\/li>\n<li>If \u201cturn lights on\u201d command is received in a message, the script understands that it is to turn the light on, so it will send the \u201cON\u201d command to the microcontroller through serial communication. The controller will turn the light on by turning the relay on.<\/li>\n<\/ul>\n<p>IoT devices do not directly support the WhatsApp API, so the data must be transferred from one protocol to another. In the next article, \u201cProtocol bridging\u201d, we will see how to redirect messages sent from WhatsApp to MQTT.<\/p>\n<p><strong>Installing the WhatsApp API in Linux<\/strong><\/p>\n<p><strong>Step 1 \u2013 Preparing the system<br \/>\n<\/strong>This API works on python, so we need to set the environment first to install it in the system. We can do that by entering the following command in the terminal.<\/p>\n<p><span style=\"color: #993300;\"><strong>Sudo apt-get update<br \/>\n<\/strong><\/span><span style=\"color: #993300;\"><strong>sudo apt-get install python-dateutil<br \/>\n<\/strong><\/span><span style=\"color: #993300;\"><strong>sudo apt-get install python-setuptools<br \/>\n<\/strong><\/span><span style=\"color: #993300;\"><strong>sudo apt-get install python-dev<br \/>\n<\/strong><\/span><span style=\"color: #993300;\"><strong>sudo apt-get install libevent-dev<br \/>\n<\/strong><\/span><span style=\"color: #993300;\"><strong>sudo apt-get install ncurses-dev<\/strong><\/span><\/p>\n<p><strong>Step 2 \u2013 Downloading the API<br \/>\n<\/strong>Type the following command in the terminal.<br \/>\n<strong><span style=\"color: #993300;\">git clone git:\/\/github.com\/tgalal\/yowsup.git<\/span><\/strong><\/p>\n<p>Now go to the folder youwsup and type the following to install it into the system<br \/>\n<strong><span style=\"color: #993300;\">sudo python setup.py install<\/span><\/strong><\/p>\n<p>now we have installed that in our system it\u2019s time for registering the WhatsApp number.<\/p>\n<p><strong>Note- Only one number per device is allowed in WhatsApp, so you need a new number to install WhatsApp in Linux.<\/strong><\/p>\n<p><strong>Step 3 \u2013 Setting up the API<\/strong><\/p>\n<ul>\n<li>The Yowsup API comes with a command-line utility used for registration.<\/li>\n<li>To register the phone number, we need to download WhatsApp latest APK and do some stuff which is as followed.<\/li>\n<li>We need to download the latest version of WhatsApp and calculate some MD5 hash and write them to a file in WhatsApp API. So, WhatsApp does not crash and asks for an update.<\/li>\n<li>To do so follow the steps.<\/li>\n<\/ul>\n<ol>\n<li>Download this file \u2013 <a href=\"https:\/\/github.com\/mgp25\/classesMD5-64\/edit\/master\/dexMD5.py\">py<\/a><\/li>\n<li>Download WhatsApp \u2013 <a href=\"https:\/\/www.whatsapp.com\/android\/\">apk<\/a><\/li>\n<li>Put them in a folder and type the following command<br \/>\n<strong style=\"color: #993300; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;\">python dexMD5.py WhatsApp.apk<\/strong><\/li>\n<\/ol>\n<ol start=\"4\">\n<li>You will see the following output<br \/>\n<span style=\"color: #993300;\"><strong>Version: 2.17.344<br \/>\nClassesDex: OxVSHnBDYNBZmsgagatF9+A==<\/strong><\/span><\/li>\n<\/ol>\n<ol start=\"5\">\n<li>Now write Version and ClassessDex values to a file inside the API location<br \/>\n<strong><span style=\"color: #993300;\">yowsup\/env\/env_android.py<\/span><\/strong><\/li>\n<\/ol>\n<ol start=\"6\">\n<li>Now type the following command to reinstall API<br \/>\n<span style=\"color: #993300;\"><strong>python setup.py build<\/strong><\/span><br \/>\n<span style=\"color: #993300;\"><strong>python setup.py install<\/strong><\/span><\/li>\n<\/ol>\n<p><strong>Step 4. &#8211; \u00a0Registering the user<br \/>\n<\/strong>4.1 \u2013 Getting the verification code<\/p>\n<p>Now comes the registration with the WhatsApp server, which can be done by the command-line utility \u201cyowsup-cli\u201d, by using the following command.<br \/>\n<span style=\"color: #993300;\"><strong>python yowsup-cli registration &#8211;requestcode sms &#8211;phone 91xxxxxxxxxx &#8211;cc 91 &#8211;mcc 222 &#8211;mnc 10 -E android<\/strong><\/span><\/p>\n<p>Enter your phone number at 91XXXXXXXXX<\/p>\n<p>The codes MCC and MNC can be found at this link &#8211; <a href=\"http:\/\/www.mcc-mnc.com\">http:\/\/www.mcc-mnc.com<\/a><\/p>\n<p>After entering the following command, you will receive a message with a verification code of 6 digits. Keep that number stored. It will be used in the next step.<\/p>\n<p>4.2 &#8211; Getting password for login<br \/>\nTo login to WhatsApp, we will need a password string, a base64 string. We can obtain that by replacing the xxx-xxx with the six-digit number.<br \/>\n<span style=\"color: #993300;\"><strong>python yowsup-cli registration &#8211;register xxx-xxx &#8211;phone 91xxxxxxxxxx &#8211;cc 91 -E android<\/strong><\/span><\/p>\n<p>After this you will see output like this<br \/>\n<span style=\"color: #993300;\"><strong>status: ok<\/strong><\/span><br \/>\n<span style=\"color: #993300;\"><strong>kind: free<\/strong><\/span><br \/>\n<span style=\"color: #993300;\"><strong>pw: xxxxxxxxxxxxxxxxxx= #this is the password<\/strong><\/span><br \/>\n<span style=\"color: #993300;\"><strong>price: \u20b9 55<\/strong><\/span><br \/>\n<span style=\"color: #993300;\"><strong>price_expiration: 1509040085<\/strong><\/span><br \/>\n<span style=\"color: #993300;\"><strong>currency: INR<\/strong><\/span><br \/>\n<span style=\"color: #993300;\"><strong>cost: 55.00<\/strong><\/span><br \/>\n<span style=\"color: #993300;\"><strong>expiration: 4444444444.0<\/strong><\/span><br \/>\n<span style=\"color: #993300;\"><strong>login: 91xxxxxxxxxx<\/strong><\/span><br \/>\n<span style=\"color: #993300;\"><strong>type: new<\/strong><\/span><\/p>\n<p>With this installation, we got two things: a phone number at which our API is installed and a password for login. Keep them stored.<\/p>\n<p>Note \u2013 Phone number must be used with country code<br \/>\n<span style=\"color: #993300;\"><strong>Phone \u2013 91XXXXXXXX<\/strong><\/span><br \/>\n<span style=\"color: #993300;\"><strong>Password \u2013 Gbuioa254ui25j2=XXXXX<\/strong><\/span><\/p>\n<p><strong>Developing the source code<br \/>\n<\/strong>To develop the code for automation, we have to go through how the API can be called. Also, we need to write a small script in Arduino to control the relay\/led. There can be following steps to understand how the source code works.<\/p>\n<p><strong>Linux System Code<\/strong><\/p>\n<p>This side we will implement these features.<\/p>\n<ol>\n<li>Understanding the architecture of the API<\/li>\n<li>Calling the API<\/li>\n<li>Controlling the Appliances<\/li>\n<\/ol>\n<p><strong>Understanding the API architecture<br \/>\n<\/strong>The Yowsup python app works on stacks of layers. Data can be transferred from layer to layer.<\/p>\n<p>If we want to send a message, we will push that message to the lower layer.<br \/>\n<strong><span style=\"color: #993300;\">self.toLower(outgoingMessageProtocolEntity)<\/span><\/strong><\/p>\n<p>If you want to receive messages, they will be accessed from the top layer, which will be the current layer of the stack.<\/p>\n<p><strong>Calling the API<br \/>\n<\/strong>To call the API we will be making two python scripts. One will be to pass the object like username and passwords in the stack and start the stacking. The second will be our main message receiving layer on which we will receive messages and perform the tasks.<\/p>\n<p>So, the two files will be <strong>run.py<\/strong> and <strong>layer.py<\/strong><\/p>\n<p><strong>Understanding File Run.py<\/strong><\/p>\n<ul>\n<li>We will call our libraries at the top of the file<\/li>\n<\/ul>\n<p><strong><span style=\"color: #993300;\">from yowsup.stacks import\u00a0 YowStackBuilder<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">from yowsup.layers.auth import AuthError<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">from yowsup.layers import YowLayerEvent<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">from yowsup.layers.network import YowNetworkLayer<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">from yowsup.env import YowsupEnv<\/span><\/strong><\/p>\n<ul>\n<li>We will also attach the layer file on the top because the main class <strong>\u201cEcholayer\u201d <\/strong>exists inside that file.<\/li>\n<\/ul>\n<p>from layer import EchoLayer<\/p>\n<ul>\n<li>We can name the layer file anything, but we have to put the same name here.<\/li>\n<li>Inside the <strong>py, <\/strong>we will declare our main variable for password and events we want to occur.<\/li>\n<\/ul>\n<p>credentials = (&#8220;91xxxxxxxxxx&#8221;, &#8220;HkhWVW5\/Wnr493HXK8NKl\/htpno=&#8221;)<\/p>\n<ul>\n<li>Now we pass them to the layer and build the stack. Also, the loop which will keep the connection live is called.<\/li>\n<\/ul>\n<p><strong><span style=\"color: #993300;\">stack.setCredentials(credentials) stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECT))\u00a0 #sending the connect signal<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">stack.loop() #this is the program mainloop<\/span><\/strong><\/p>\n<p><strong>Understanding File layer.py<br \/>\n<\/strong>This file contains the class which will receive any messages incoming to this number, and that will be a callback entity so any other loop can be run inside the file.<\/p>\n<p><strong><span style=\"color: #993300;\">@ProtocolEntityCallback(&#8220;message&#8221;)<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">def onMessage(self, messageProtocolEntity):<br \/>\n<\/span><\/strong>\u00a0 <strong><span style=\"color: #993300;\">\u00a0 \u00a0 \u00a0 \u00a0 if True:<\/span><\/strong><\/p>\n<p>Message data and the number from which the message arrived can be obtained using the following.<br \/>\n<strong><span style=\"color: #993300;\">incomming_message_data = messageProtocolEntity.getBody()<\/span><\/strong><\/p>\n<p>This will get the message body which is the real message. It will store in a string variable \u201cincomming_message_data\u201d<br \/>\n<strong><span style=\"color: #993300;\">incomming_message_sender = messageProtocolEntity.getFrom()<\/span><\/strong><\/p>\n<p>This line will store incoming message contact number in the string variable \u201cincomming_message_sender\u201d<\/p>\n<p>By using those two values, we can do anything one receiving any specific message or from a specific number. This function will always keep receiving the data when arrived.<\/p>\n<p>Below is how we will use them to make our home automation project.<\/p>\n<p><strong>Controlling the Appliances<br \/>\n<\/strong>To control the home appliances, we need to write a code that can interact with the code written in Arduino.<\/p>\n<p><a href=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-04-at-3.10.26-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-76274\" src=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-04-at-3.10.26-PM.png\" alt=\"\" width=\"573\" height=\"102\" srcset=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-04-at-3.10.26-PM.png 573w, https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-04-at-3.10.26-PM-300x53.png 300w, https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-04-at-3.10.26-PM-368x66.png 368w\" sizes=\"auto, (max-width: 573px) 100vw, 573px\" \/><\/a><\/p>\n<p>We will use this simple approach in which we will write a code in Arduino that can control a pins output when such commands are received.<\/p>\n<p><span style=\"font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;\"><br \/>\nWe now open the serial port for communication<\/span>So, in the code we will import our \u201cpyserial\u201d library.<br \/>\n<span style=\"color: #993300;\"><strong>import serial<\/strong><\/span><\/p>\n<p><span style=\"color: #993300;\"><strong>ser = serial.Serial(port, baud, timeout=1)<\/strong><\/span><\/p>\n<p>To turn any pins on or off in Arduino, we need to send data on serial. Also, first, we need to read the incoming message from WhatsApp.<br \/>\n<strong><span style=\"color: #993300;\">elif(&#8220;lights on&#8221; in\u00a0 incomming_msg):<br \/>\n<\/span><span style=\"color: #993300;\">ser.write(&#8220;on&#8221;.encode(&#8216;ascii&#8217;))<\/span><\/strong><\/p>\n<p>This line says if there is \u201clights on\u201d in the string \u201cincoming_msg\u201d (which is the message we received), then send the string \u201con\u201d at the serial port.<\/p>\n<p>The rest can be understood from inside the Arduino code.<\/p>\n<p>For sending the message back to WhatsApp, we will use this line,<br \/>\n<strong><span style=\"color: #993300;\">outgoingMessageProtocolEntity = TextMessageProtocolEntity(message_send,to = sender_jid)<\/span><\/strong><\/p>\n<p><strong>Hardware Code (Arduino)<\/strong><\/p>\n<p>In the Arduino, we will simply write a code that listens for incoming strings at the serial port, and then if it says \u201con,\u201d turn a pin at which the LED is connected HIGH, or if it says \u201coff,\u201d turn the LED pin LOW.<\/p>\n<p><strong><span style=\"color: #993300;\">If(Serial.available()){<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 String data = Serial.readString();<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if(data == &#8220;on&#8221;){<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 digitalWrite(13,HIGH);<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0Else if(data == &#8220;off&#8221;){<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 digitalWrite(13,LOW);<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/span><\/strong><br \/>\n<strong><span style=\"color: #993300;\">}<\/span><\/strong><\/p>\n<p>This is how our automation code works. To learn more about XMPP read our previous articles.<\/p>\n<p><strong>Note:<\/strong><\/p>\n<ul>\n<li>Do not use WhatsApp API (Yowsup) with Raspbian OS, or your number will get banned from using WhatsApp. Install it in Ubuntu or any other Linux distribution.<\/li>\n<li>WhatsApp from one number can be installed on only one device at a time.<\/li>\n<li>Message sending frequency must not be fast like 30 messages in a minute is the limit you can go, above that there are chances that your number might get blocked from WhatsApp.<\/li>\n<\/ul>\n<div style=\"width: 740px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-71352-1\" width=\"740\" height=\"400\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/video.mp4?_=1\" \/><a href=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/video.mp4\">https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/video.mp4<\/a><\/video><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will learn how to control our IoT home appliances using the messaging app WhatsApp to easily and effectively communicatie with those devices. So we will be sending WhatsApp messages to a number of \u201clights on,\u201d and lights at our house will turn ON. Components required \u00a0Tools Required\/ libraries required: WhatsApp API&hellip;<\/p>\n","protected":false},"author":64,"featured_media":76273,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[13],"tags":[1272,1846,3375],"class_list":{"2":"type-post","11":"entry","12":"has-post-thumbnail"},"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.2 (Yoast SEO v25.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>WhatsApp-based home automation<\/title>\n<meta name=\"description\" content=\"Learn how to control IoT home appliances using the messaging app WhatsApp to easily and effectively communicatie with those devices.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WhatsApp-based home automation\" \/>\n<meta property=\"og:description\" content=\"Learn how to control IoT home appliances using the messaging app WhatsApp to easily and effectively communicatie with those devices.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/\" \/>\n<meta property=\"og:site_name\" content=\"Engineers Garage\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/engineersgarage\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/xmppwhatsapp.png\" \/>\n\t<meta property=\"og:image:width\" content=\"861\" \/>\n\t<meta property=\"og:image:height\" content=\"571\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ashutosh Bhatt\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@EngineersGarage\" \/>\n<meta name=\"twitter:site\" content=\"@EngineersGarage\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ashutosh Bhatt\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/\"},\"author\":{\"name\":\"Ashutosh Bhatt\",\"@id\":\"https:\/\/www.engineersgarage.com\/#\/schema\/person\/ff80aa34dc1249eb691d684fec9d1c06\"},\"headline\":\"WhatsApp-based home automation\",\"datePublished\":\"2025-03-30T22:12:24+00:00\",\"dateModified\":\"2025-04-20T11:06:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/\"},\"wordCount\":1674,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.engineersgarage.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/xmppwhatsapp.png\",\"keywords\":[\"home automation\",\"python\",\"Whatsapp\"],\"articleSection\":[\"Electronic Projects\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/\",\"url\":\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/\",\"name\":\"WhatsApp-based home automation\",\"isPartOf\":{\"@id\":\"https:\/\/www.engineersgarage.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/xmppwhatsapp.png\",\"datePublished\":\"2025-03-30T22:12:24+00:00\",\"dateModified\":\"2025-04-20T11:06:47+00:00\",\"description\":\"Learn how to control IoT home appliances using the messaging app WhatsApp to easily and effectively communicatie with those devices.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#primaryimage\",\"url\":\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/xmppwhatsapp.png\",\"contentUrl\":\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/xmppwhatsapp.png\",\"width\":861,\"height\":571},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.engineersgarage.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WhatsApp-based home automation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.engineersgarage.com\/#website\",\"url\":\"https:\/\/www.engineersgarage.com\/\",\"name\":\"Engineers Garage\",\"description\":\"Electronic Projects, Electrical Engineering Resources, Makers Articles and Product News\",\"publisher\":{\"@id\":\"https:\/\/www.engineersgarage.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.engineersgarage.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.engineersgarage.com\/#organization\",\"name\":\"Engineer's Garage - WTWH Media\",\"url\":\"https:\/\/www.engineersgarage.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.engineersgarage.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2019\/08\/EGlogo.png\",\"contentUrl\":\"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2019\/08\/EGlogo.png\",\"width\":372,\"height\":52,\"caption\":\"Engineer's Garage - WTWH Media\"},\"image\":{\"@id\":\"https:\/\/www.engineersgarage.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/engineersgarage\",\"https:\/\/x.com\/EngineersGarage\",\"https:\/\/www.youtube.com\/channel\/UC0VITh11JSYk-UW7toLebUw\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.engineersgarage.com\/#\/schema\/person\/ff80aa34dc1249eb691d684fec9d1c06\",\"name\":\"Ashutosh Bhatt\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.engineersgarage.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/68b3974894b20e23ded96f2892a241268df7ecec2258979fa47e5e0955676822?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/68b3974894b20e23ded96f2892a241268df7ecec2258979fa47e5e0955676822?s=96&r=g\",\"caption\":\"Ashutosh Bhatt\"},\"url\":\"https:\/\/www.engineersgarage.com\/author\/abhatt\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"WhatsApp-based home automation","description":"Learn how to control IoT home appliances using the messaging app WhatsApp to easily and effectively communicatie with those devices.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/","og_locale":"en_US","og_type":"article","og_title":"WhatsApp-based home automation","og_description":"Learn how to control IoT home appliances using the messaging app WhatsApp to easily and effectively communicatie with those devices.","og_url":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/","og_site_name":"Engineers Garage","article_publisher":"https:\/\/www.facebook.com\/engineersgarage","og_image":[{"width":861,"height":571,"url":"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/xmppwhatsapp.png","type":"image\/png"}],"author":"Ashutosh Bhatt","twitter_card":"summary_large_image","twitter_creator":"@EngineersGarage","twitter_site":"@EngineersGarage","twitter_misc":{"Written by":"Ashutosh Bhatt","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#article","isPartOf":{"@id":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/"},"author":{"name":"Ashutosh Bhatt","@id":"https:\/\/www.engineersgarage.com\/#\/schema\/person\/ff80aa34dc1249eb691d684fec9d1c06"},"headline":"WhatsApp-based home automation","datePublished":"2025-03-30T22:12:24+00:00","dateModified":"2025-04-20T11:06:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/"},"wordCount":1674,"commentCount":0,"publisher":{"@id":"https:\/\/www.engineersgarage.com\/#organization"},"image":{"@id":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#primaryimage"},"thumbnailUrl":"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/xmppwhatsapp.png","keywords":["home automation","python","Whatsapp"],"articleSection":["Electronic Projects"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/","url":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/","name":"WhatsApp-based home automation","isPartOf":{"@id":"https:\/\/www.engineersgarage.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#primaryimage"},"image":{"@id":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#primaryimage"},"thumbnailUrl":"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/xmppwhatsapp.png","datePublished":"2025-03-30T22:12:24+00:00","dateModified":"2025-04-20T11:06:47+00:00","description":"Learn how to control IoT home appliances using the messaging app WhatsApp to easily and effectively communicatie with those devices.","breadcrumb":{"@id":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#primaryimage","url":"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/xmppwhatsapp.png","contentUrl":"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/xmppwhatsapp.png","width":861,"height":571},{"@type":"BreadcrumbList","@id":"https:\/\/www.engineersgarage.com\/whatsapp-based-home-automation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.engineersgarage.com\/"},{"@type":"ListItem","position":2,"name":"WhatsApp-based home automation"}]},{"@type":"WebSite","@id":"https:\/\/www.engineersgarage.com\/#website","url":"https:\/\/www.engineersgarage.com\/","name":"Engineers Garage","description":"Electronic Projects, Electrical Engineering Resources, Makers Articles and Product News","publisher":{"@id":"https:\/\/www.engineersgarage.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.engineersgarage.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.engineersgarage.com\/#organization","name":"Engineer's Garage - WTWH Media","url":"https:\/\/www.engineersgarage.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.engineersgarage.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2019\/08\/EGlogo.png","contentUrl":"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2019\/08\/EGlogo.png","width":372,"height":52,"caption":"Engineer's Garage - WTWH Media"},"image":{"@id":"https:\/\/www.engineersgarage.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/engineersgarage","https:\/\/x.com\/EngineersGarage","https:\/\/www.youtube.com\/channel\/UC0VITh11JSYk-UW7toLebUw"]},{"@type":"Person","@id":"https:\/\/www.engineersgarage.com\/#\/schema\/person\/ff80aa34dc1249eb691d684fec9d1c06","name":"Ashutosh Bhatt","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.engineersgarage.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/68b3974894b20e23ded96f2892a241268df7ecec2258979fa47e5e0955676822?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/68b3974894b20e23ded96f2892a241268df7ecec2258979fa47e5e0955676822?s=96&r=g","caption":"Ashutosh Bhatt"},"url":"https:\/\/www.engineersgarage.com\/author\/abhatt\/"}]}},"featured_image_src":"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/xmppwhatsapp-600x400.png","featured_image_src_square":"https:\/\/www.engineersgarage.com\/wp-content\/uploads\/2022\/05\/xmppwhatsapp-600x571.png","author_info":{"display_name":"Ashutosh Bhatt","author_link":"https:\/\/www.engineersgarage.com\/author\/abhatt\/"},"_links":{"self":[{"href":"https:\/\/www.engineersgarage.com\/wp-json\/wp\/v2\/posts\/71352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.engineersgarage.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.engineersgarage.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.engineersgarage.com\/wp-json\/wp\/v2\/users\/64"}],"replies":[{"embeddable":true,"href":"https:\/\/www.engineersgarage.com\/wp-json\/wp\/v2\/comments?post=71352"}],"version-history":[{"count":0,"href":"https:\/\/www.engineersgarage.com\/wp-json\/wp\/v2\/posts\/71352\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.engineersgarage.com\/wp-json\/wp\/v2\/media\/76273"}],"wp:attachment":[{"href":"https:\/\/www.engineersgarage.com\/wp-json\/wp\/v2\/media?parent=71352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.engineersgarage.com\/wp-json\/wp\/v2\/categories?post=71352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.engineersgarage.com\/wp-json\/wp\/v2\/tags?post=71352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}