Updating light button status from ESP-01 to android

Good day all, I currently have a running code on esp-01 to switch an arduino based light bulb from an android app. I also added a momentary push button to physically control the same light.

The ESP-01 has both RF transmitter and receiver connected to it; likewise the arduino circuit connected to the bulb. If the bulb is switched physically, the arduino transmits a code to the ESP-01.

I wish to update the status of the android button if the momentary push button is used to turn on the light. Does anyone have an idea how to make this work if its even possible.

I currently have a running code

But, you forgot to post it.

I wish to update the status of the android button

What android button?

Here is the code

****Arduino Code ****

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();
const int transmit_pin = 2;
const int receive_pin = 0;

/* Set these to your desired credentials. */
const char *ssid = "**********";
const char *password = "************";
uint16_t code;
String response_data = "";
int no_of_transmissions = 1;

ESP8266WebServer server(80);

void entrance_light_ON()
  response_data = "<h1>101</h1>";
  code = response_data.substring(4, 7).toInt();

void send_response(String data)
  server.send(200, "text/html", data);

void sendCode(uint16_t code)
  Serial.print("Sent code = ");

  sendMultiple(code, no_of_transmissions);
  Serial.println("Data Sent");

void sendMultiple(uint16_t msg, int transmissions)
  if (transmissions >= 1)
    for (int i = 0; i < transmissions; i++)
      mySwitch.send(msg, 24);

void receiver()
  if (mySwitch.available())
    uint16_t Rcode = mySwitch.getReceivedValue();
    //for water_level, pattern = 133/No%

    if (Rcode.indexOf("/") >= 0) //received code contains "/" for water level
      Rcode = Rcode.substring(Rcode.indexOf("/"), Rcode.length());
String text = "<h1>133/";
      text = text + Rcode;
      text = text + "</h1>";      
      String text = "<h1>";
      text = text + Rcode;
      text = text + "</h1>";      
    response_data = text;

void setup()

  //setup transmitter

  WiFi.softAP(ssid, password);

  IPAddress myIP = WiFi.softAPIP();

  //ON commands
  server.on("/L_101", entrance_light_ON);


void loop()

The above code can receive data from the RF receiver on request from the android app. Attached is a screen shot of the app.

Now, I’m asking if there is a way to send http response from ESP without having to initiate a request.

Capture 2.JPG

It's not really an Arduino question but more a HTTP question.

Google http response without http request and see what you can find.