 	);
 	const int NUMBER_OF_ROOT_PARAMETERS = 1;
 	// See JSON_OBJECT_SIZE to predict buffer size
-	// Let's make double the prediction
-	const int BUFFER_SIZE = 2 * (JSON_OBJECT_SIZE(NUMBER_OF_ROOT_PARAMETERS));
+	// Let's make 3x of the prediction
+	const int BUFFER_SIZE = 3 * (JSON_OBJECT_SIZE(NUMBER_OF_ROOT_PARAMETERS));
 	StaticJsonBuffer<BUFFER_SIZE> jsonBuffer;
-	JsonObject& root = jsonBuffer.parseObject((char*)payload);
+	JsonObject& root = jsonBuffer.parseObject(&payload[0]);
 	// Check if parsing succeeds
 	if (!root.success()) {
 		LOG_PRINTFLN("ERROR, Can't pars configuration");
 		return;
 	}
 	publishPeriodMs = root["period"];
+	// TODO: Store publishPeriodMs to EEPROM
+	// TODO: Reconnect if publishPeriodMs is changed to update keep-alive timer
 }
 
 void networkHibernate(unsigned long delay) {

void(* reset) (void) = 0;//declare reset function at address 0
void check();
void connect();
void buildMessagePayload(char* buffer, int size);
void processMessageConfig(MqttClient::MessageData& md);
void networkHibernate(unsigned long);

			Lpm::idle(MQTT_DISCONNECTED_IDLE_PERIOD_MS);
			networkWakeUp(NETWORK_WAKE_UP_DELAY_MS);
		} else {
			connectCounter = 0;
			// Do the publish immediately after reconnect
			firstPublish = true;
		}
	} else {
		// Connected
