bluetooth controled power relay with button

Hello, I was trying to make my lamp bluetooth-controled. Bluetooth mode is just fine. However, I try to add second method of power switching - with just a normal button. I can't make it right. When I use button switch power/relay change position as long as I push it. Then it comes back to previous (bluetooth-defined) position.

Here is the code:

/*
   created by Rui Santos, http://randomnerdtutorials.com
   Bluetooth App - Turn On and Off LED
*/

int relay_pin = 13;
int state;
#define button A3

void setup() {
  pinMode(button, INPUT_PULLUP);
  pinMode(relay_pin, OUTPUT);
  Serial.begin(115200);
  digitalWrite(relay_pin, HIGH);
}

void loop() {
  if (Serial.available() > 0)
  {
    state = Serial.read();
  }

  if (state == '1') {
    digitalWrite(relay_pin, LOW);
  }

  else if (state == '2') {
    digitalWrite(relay_pin, HIGH);
  }


  delay(100);               // wait for 100ms
  //For debugging purpose
  Serial.println(state);

  if (digitalRead(button) == LOW)
  {
    delay(350);
    digitalWrite(relay_pin, !digitalRead(relay_pin));
    while (digitalRead(button) == LOW);
    delay(100);
  }


}

What I have to change to make it work? I was trying for few hours and nothing.

Thanls

(deleted)

Thanks but what do you mean? State is variable defined by bluetooth device (smartphone etc). I can't change it using "!state".

(deleted)

OK! Thank for your advices! It works! The key was to redefine "state" variable after changing the relay pin state. I'm pasting the solution - maybe I'll help someone:

/*
   created by Rui Santos, http://randomnerdtutorials.com
   Bluetooth App - Turn On and Off LED
*/

int relay_pin = 13;
int state;
#define button A3

void setup() {
  pinMode(button, INPUT_PULLUP);
  pinMode(relay_pin, OUTPUT);
  Serial.begin(115200);
  state = '2'; // relay is OFF after switch on the device
}

void loop() {
  // bluetooth as switch
  if (Serial.available() > 0)
  {
    state = Serial.read();
  }

  if (state == '1')
  {
    digitalWrite(relay_pin, LOW);
  }

  else if (state == '2')
  {
    digitalWrite(relay_pin, HIGH);
  }
  delay(100);
  Serial.println(state);


  // button as switch
  if (digitalRead(button) == LOW)
  {
    delay(350);
    if (state == '1')
    {
      digitalWrite(relay_pin, HIGH);
      state = '2';
    }
    else if (state == '2')
    {
      digitalWrite(relay_pin, LOW);
      state = '1';
    }

    while (digitalRead(button) == LOW);
    delay(100);
  }

}