From ddb7a6a4493b32b45f1b00f4cbbd61a8f45ff2cf Mon Sep 17 00:00:00 2001 From: jameswood Date: Wed, 2 Sep 2015 22:51:14 +1000 Subject: [PATCH] Retain FEWER things! Just retain status (online/offline), not all events --- PrawnBot-ESP.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PrawnBot-ESP.ino b/PrawnBot-ESP.ino index a1ca2c6..81c590d 100644 --- a/PrawnBot-ESP.ino +++ b/PrawnBot-ESP.ino @@ -59,7 +59,7 @@ void connectWifi(){ boolean connectMQTT(){ if(mqttclient.connect(myName, statusTopic, 2, true, (char*)("offline"))){ - mqttclient.publish(statusTopic, (char*)("online")); + mqttclient.publish(statusTopic, (byte*)("online"), 6, true); mqttclient.subscribe(controlTopic); } } @@ -93,12 +93,13 @@ void loop(){ botMode = 0; modeStartTime = 0; Serial.println("Fed"); - mqttclient.publish(controlTopic, (byte*)("fed"), 3, true); //3 is length + mqttclient.publish(controlTopic, (char*)("fed")); //3 is length } else if(millis() - modeStartTime > jamTimeout){ botMode = 2; //jammed Serial.println("Jammed"); - mqttclient.publish(statusTopic, (byte*)("jam"), 3, true); //3 is length + //mqttclient.publish(statusTopic, (byte*)("jam"), 3, true); //3 is length + mqttclient.publish(statusTopic, (char*)("jam")); } break; }