attachInterrupt false triggering

All,
I am having an issue that i am not sure what to do next, i am not a electronic guy just read a bunch so please bear with me. I am using an esp8266, but i have to think this would be same issue on arduino that is connected to a simple push switch that when the switch is pushed it turns on some LED strips via a FET board that i found on Amazon. Everything works great. I have this setup turning the lights on in my workshop. however it does toggle my lights (on or off based on the state when the button is pushed.) when it is getting some type of noise. like when my heater kicks on or i have an old fluorescent lamp sometimes when i turn it on it will toggle the lights. What i have tried to do is:

1 added a 10k pull up resistor
2. powered everything from batteries
3. powered by a stronger power supply plugged into a UPS on battery side.

things i wonder about...
1 button is about 30 feet away so is the wire being that long an issue?
2 do i need to add a capacitor between pin and ground (read about this)

my code is pretty standard

in setup
attachInterrupt(digitalPinToInterrupt(buttonPin), InterruptHandler, FALLING);

if(interruptFlag > 0)
{

senddata(1,"Shop Lights has been toggled"); //send reading to my web services
toggle();
delay(2000);
interruptFlag = 0;
}

Outside setup

void toggle()
{
bool x = relaystate;

relaystate = !relaystate;
digitalWrite(relayPin, relaystate);
server.send(200, "text/plain", "Lights toggled");
if(x == LOW)
{
sendnotification("Shop Lights Toggled Off"); //send notifications to my mobile app
}
else
{
sendnotification("Shop Lights Toggled On"); //send notifications to my mobile app
}
}

image of my setup...

any ideas would be helpful
thanks tim

Why do you need an interrupt to read the state of a switch? Presumably, that switch is pressed by a human, who wouldn't notice a slight delay in the lights coming on or going off.

Post ALL of your code, so we can see what your interrupt handler is doing.

I wouldn’t put print statements or delays in an interrupt routine .

If you just used a push button you can use code to check its still pressed a few mS later , this will be less suseptable to noise , being a level rather than edge.

The board might be better the other way around too, so the aerial isn’t in the middle of a load of wires.

I did have the code do polling at first, but after reading on attachinterrupts i thought that was the better way.

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include<stdio.h>
#include<stdlib.h>
#include <ArduinoJson.h>
#include <WiFiManager.h>
#include <ESP8266HTTPClient.h>
#include <string.h>;

ESP8266WebServer server(80);

int relayPin = D2;
bool relaystate = LOW;
int heartbeatcheck = 0;
int myheartbeatcount = 0;
int sentcount =0;
int intervalChk =5; //from getVariables to change how often it should send data in by default every 5 min
int sense_Pin = 0; // sensor input at Analog pin A0
int value = 0;
int sendNoteChk =61;
int buttonPin = D5; // the number of the pushbutton pin
int buttonState = 0;
volatile byte interruptFlag = 0;
char clientkey[] = "";
char taskkey[] = "";

void setup()
{
// put your setup code here, to run once:
pinMode(relayPin, OUTPUT);
Serial.begin(115200);
WiFiManager wifiManager;
wifiManager.autoConnect("ShieldOneAP");
attachInterrupt(digitalPinToInterrupt(buttonPin), InterruptHandler, FALLING);
server.on("/on", turnOn); //Associate the handler function to the path
server.on("/off", turnOff); //Associate the handler function to the path
server.on("/toggle", toggle); //Associate the handler function to the path
server.begin(); //Start the server
Serial.println("Server listening");
setvariables();

}

void loop()
{
// for web server
server.handleClient();

if(interruptFlag > 0)
{

senddata(1,"Shop Lights has been toggled");
toggle();
delay(2000);
interruptFlag = 0;
}

if(heartbeatcheck > 18000000)
{
Serial.println("heartbeat ");
senddata(99999,"HeartBeat"); //if using senddata function five 9s means heartbeat
delay( 1000 );
Serial.println("Variable check ");
getvariables();
delay( 1000 );
heartbeatcheck = 0;
}
else
{
heartbeatcheck++;
}

/* works, commented out in favor of attachInterrupt

buttonState = digitalRead( buttonPin );

// Now do stuff that should be triggered by the button press
if ( buttonState == HIGH )
{
delay( 250 ); // This prevents the button state from being read again for half a second.
}
else
{
Serial.println("switch has been pushed");
senddata(buttonState,"1");
delay( 500 );
toggle();
delay(500);
}

*/
}

void InterruptHandler()
{
interruptFlag++;
}

void turnOn()
{
Serial.println("turn on");
relaystate = HIGH;
digitalWrite(relayPin, relaystate);
server.send(200, "text/plain", "Lights turned on");
sendnotification("Shop Lights Turned On");
}

void turnOff()
{
Serial.println("turn off");
relaystate = LOW;
digitalWrite(relayPin, relaystate);
server.send(200, "text/plain", "Lights turned off");
sendnotification("Shop Lights Turned Off");

}

void toggle()
{
bool x = relaystate;
relaystate = !relaystate;
digitalWrite(relayPin, relaystate);
server.send(200, "text/plain", "Lights toggled");
if(x == LOW)
{
sendnotification("Shop Lights Toggled Off");
}
else
{
sendnotification("Shop Lights Toggled On");
}
}

void senddata(int myreading,char mybody[1200])
{
HTTPClient myhttp;
myhttp.begin("http://yousvc.azurewebsites.net/api/SendReading");
myhttp.addHeader("Content-Type", "application/json");
const size_t bufferSize = JSON_OBJECT_SIZE(4) + 140;
DynamicJsonBuffer jsonBuffer(bufferSize);
char wrkjson[500] = "{"ClientKey":"";
strcat(wrkjson, clientkey);
strcat(wrkjson,"","TaskId":"");
strcat(wrkjson, taskkey);
strcat(wrkjson,"","MsgBody":"");
strcat(wrkjson, mybody);
strcat(wrkjson, "","Reading":");
char wrk[7];
sprintf(wrk,"%ld", myreading);
strcat(wrkjson, wrk);
strcat(wrkjson, "}");
Serial.print(wrkjson);
const char* json = wrkjson;
int httpCode = myhttp.POST((uint8_t *)json,strlen(json));
if(httpCode == HTTP_CODE_OK)
{
Serial.print("HTTP response code ");
Serial.println(httpCode);
String response = myhttp.getString();
Serial.println("send reading " + response);
}
else
{
Serial.println("Error in HTTP request");
Serial.println(httpCode);
}
myhttp.end();
}

void getvariables()
{
int result;
int result2;
HTTPClient myhttp;
myhttp.begin("http://yousvc.azurewebsites.net/api/TaskVariable");
myhttp.addHeader("Content-Type", "application/json");

char wrkjson[500] = "{"ClientKey":"";
strcat(wrkjson, clientkey);
strcat(wrkjson,"","TaskKey":"");
strcat(wrkjson, taskkey);
strcat(wrkjson,""}");
Serial.print(wrkjson);
const char* json = wrkjson;
int httpCode = myhttp.POST((uint8_t *)json,strlen(json));

if(httpCode == HTTP_CODE_OK)
{
Serial.print("HTTP response code ");
Serial.println(httpCode);
String response = myhttp.getString();
Serial.println("get var " + response);
char myresponse[975];
response.toCharArray(myresponse,975);
StaticJsonBuffer<975> JSONBuffer; //Memory pool
JsonObject& parsed = JSONBuffer.parseObject(myresponse); //Parse message

if (!parsed.success())
{
Serial.println("Parsing failed");
delay(5000);
return;
}

const char * sensorType = parsed["TheSwitchValue"]; //Get sensor type value
Serial.println(sensorType);
result = strcmp(sensorType, "true");
if (result == 0)
{
//Serial.print("entering");
turnOn();
setToggleSwitch();
}

const char * sensorType2 = parsed["TheSwitchValue2"]; //Get sensor type value
Serial.println(sensorType2);
result2 = strcmp(sensorType2, "true");
if (result2 == 0)
{
//Serial.print("entering");
turnOff();
setToggleSwitch();
}

}
else
{
Serial.println("Error in HTTP request");
Serial.println(httpCode);
}

myhttp.end();

}

void setvariables()
{
char buffer[100];
sprintf(buffer, WiFi.localIP().toString().c_str());
HTTPClient myhttp;
myhttp.begin("http://yousvc.azurewebsites.net/api/SetTaskVariable");
myhttp.addHeader("Content-Type", "application/json");
const size_t bufferSize = JSON_OBJECT_SIZE(4) + 140;
DynamicJsonBuffer jsonBuffer(bufferSize);
char wrkjson[800] = "{"ClientKey":"";
strcat(wrkjson, clientkey);
strcat(wrkjson,"","TaskKey":"");
strcat(wrkjson, taskkey);
strcat(wrkjson,"","IpAddress":"");
strcat(wrkjson, buffer);
strcat(wrkjson,""}");
Serial.print(wrkjson);
const char* json = wrkjson;
int httpCode = myhttp.POST((uint8_t *)json,strlen(json));

if(httpCode == HTTP_CODE_OK)
{
Serial.print("HTTP response code ");
Serial.println(httpCode);
String response = myhttp.getString();
Serial.println("set the var " + response);

}
else
{
Serial.println("Error in HTTP request");
Serial.println(httpCode);
}

myhttp.end();
}

void setToggleSwitch()
{
char buffer[100];
sprintf(buffer, WiFi.localIP().toString().c_str());
Serial.print("In Set Toggle Switch On");
HTTPClient myhttp;
myhttp.begin("http://yousvc.azurewebsites.net/api/SetTaskVariable");
myhttp.addHeader("Content-Type", "application/json");
const size_t bufferSize = JSON_OBJECT_SIZE(4) + 175;
DynamicJsonBuffer jsonBuffer(bufferSize);
const char* json = "{"ClientKey":"f239","TaskKey":"6b4a676","TheSwitchValue":"false","TheSwitchValue2":"false"}";
Serial.print(json);
int httpCode = myhttp.POST((uint8_t *)json,strlen(json));

if(httpCode == HTTP_CODE_OK)
{
Serial.print("HTTP response code ");
Serial.println(httpCode);
String response = myhttp.getString();
Serial.println("set the var " + response);
}
else
{
Serial.println("Error in HTTP request");
Serial.println(httpCode);
}

myhttp.end();

}

void sendnotification(char mybody[200])
{

}