Push Button Independent

Hello everyone.

I have an Arduino connected to Cayenne platform.
Is working well , I can control the lamps in my house perfectly.

I would like to add a physical switch for lamps , working independently .

I’m having trouble writing the code , could someone help me?

Thank you in advance to all of this community.

My push button
Imgur

My Code

_include "CayenneDefines.h"_
_include "BlynkSimpleEsp8266.h"_
_include "CayenneWiFiClient.h"_

include <Wire.h>

int LAMP = D2;

char token = “token”;
char ssid = “ssid”;
char password = “pass”;

void setup()
{
pinMode(LAMP, OUTPUT);
Serial.begin(921600);
Cayenne.begin(token, ssid, password);
}

CAYENNE_IN(V1)
{
int currentValue = getValue.asInt(); // 0 to 1
if (currentValue == 0) {
digitalWrite(LAMP, HIGH);
} else {
digitalWrite(LAMP, LOW);
}

void loop()
{
Cayenne.run();
}

I need use only phisical switch for one lamp.

Is this button a manual over ride (like a regular light switch on your wall) or a button connected to the Arduino?

I think, using software-
“XOR” 2 values,
make the Arduino integrated into the actual lamp,
rewire the existing lamp switch, make it a GPIO input.
use a Cayenne connected relay to switch lamp power,
and you will have a boolean exclusive OR.
XOR the existing physical lamp switch
with an existing Cayenne widget toggle.