Yun/MQTT works great for about 45 minutes then Arduino loses connection

-Running Yun with this sketch:

(Will paste below)

-Running Openhab and Mosquitto servers both running fine on a raspberry pi

Any ideas what it could be? It works fine until I leave it for about 45 minutes and I get the message in the Openhab terminal that the Arduino has been disconnected. Mosquitto and Openhab server still running fine after that on the Pi.

------ Yun sketch --------

#include <SPI.h>
#include <PubSubClient.h>
#include <YunClient.h>
#include <Adafruit_NeoPixel.h>

#define PIN 6
#define PIN2 8
#define BRIGHT 255

Adafruit_NeoPixel strip = Adafruit_NeoPixel(144, PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip2 = Adafruit_NeoPixel(144, PIN2, NEO_GRB + NEO_KHZ800);

void callback(char* topic, byte* payload, unsigned int length){
//listening on the subscribed topic and then converting message to string
//convert byte to char
payload[length] = ‘\0’;
String strPayload = String((char*)payload);
Serial.println(topic); Serial.println(strPayload);

// handle message arrived
if(strPayload == “1”) {
digitalWrite(13, HIGH);
strip.show();
strip2.show();
strip.setBrightness(BRIGHT);
strip2.setBrightness(BRIGHT);
fireEffect();
}
else if(strPayload == “0”) {
digitalWrite(13, LOW);
strip.show();
strip2.show();
strip.setBrightness(0);
strip2.setBrightness(0);
}
else if(strPayload == “10”) {
digitalWrite(13, HIGH);
strip.show();
strip2.show();
strip.setBrightness(3);
strip2.setBrightness(3);
}
else if(strPayload == “100”) {
digitalWrite(13, HIGH);
strip.show();
strip2.show();
strip.setBrightness(80);
strip2.setBrightness(80);
}
else{}

}

void fireEffect() {

int r = 255;
int g = r-110;
int b = 10;

for(int x = 8; x <99; x++) {
int flicker = random(0,180);
int r1 = r-flicker;
int g1 = g-flicker;
int b1 = b-flicker;
if(g1<0) g1=0;
if(r1<0) r1=0;
if(b1<0) b1=0;
strip.setPixelColor(x,r1,g1, b1);
strip2.setPixelColor(x,r1,g1, b1);
}

delay(random(50,150));
strip.show();
strip2.show();
}

byte server = { 192, 168, 0, 17 };
int port = 1883;
char* pubTopic = “openhab/garage/relay1”;
char* subTopic = “openhab/garage/relay1”;

YunClient yun;
PubSubClient mqtt(server, port, callback, yun);

void setup() {
Serial.begin(9600);
Bridge.begin();
pinMode(13, OUTPUT);
digitalWrite(13, LOW);

strip.setBrightness(BRIGHT);
strip2.setBrightness(BRIGHT);

if (mqtt.connect(“arduinoClient”)) {
mqtt.publish(pubTopic,“Connected!”);
mqtt.subscribe(subTopic);
}

// Initialize all pixels to ‘off’
strip.begin();
strip.show();
strip2.begin();
strip2.show();

mqtt.publish(pubTopic,“0”); //turn off lights on initial reset of arduino
delay(2000);
mqtt.publish(pubTopic,“1”);
delay(2000);
mqtt.publish(pubTopic,“0”);

}

void loop() {

fireEffect();
mqtt.loop();
delay(50);

}

Run that code on the linux side, on python, and use the atmega only for sensor or actioning.