I wasn’t in love. And I really wanted to sleep. I had arrived in Bangkok in the evening after 21 hours and two sleepless flights. I was exhausted. It was 11 p.m. here, but my body thought it was still in New York where, under normal circumstances, and on its way to lunch somewhere. I felt edgy, nervous and a tad excited, as I always was when I arrive in a new place. My hotel was a five-star palace of pampering. It should be engineered for good sleep. After all, when you boil it down, isn’t that the business hotels are in: the good sleep business?

And yet, there were issues: My curtains wouldn’t shut all the way. A digital alarm clock with glowing green numbers illuminated the room like a spotlight. The sounds of the city, not to mention the elevator opening and closing just outside my door, penetrated the walls of my room.

And then I remembered I had recently talked to someone who walked and breathed sleep. Rebecca Robbins, the resident sleep expert at the Benjamin Hotel in New York City, has a Ph.D. in sleep studies. She talks about sleep like most people speak of the weather.

To ensure solitude, she told me, ask for a room in the back of the hotel or away from the elevator. It was too late for that. I was laying in bed, and I wasn’t about to march down to the front desk and ask for another room. “Noise above 60 decibels can interrupt our sleep,” she said. “If all else fails, bring earplugs.” I had those! Check.

Hotels, of course, should be for sleep. But as we travel more, properties have begun a series of one-upsmanship in an attempt to woo the well-healed and sophisticated. Among the most ridiculous, several hotels offer an in-house pet psychiatrist. Some properties have fragrance butlers and others offer wake-up calls from celebrities.

I suppose an in-house sleep expert doesn’t fall too far from the above, but at least the priorities are right.

“Keep the air temperature at 65 degrees,” was another piece of advice from Robbins. “It’s the optimal temperature for sleeping. As soon as you check-in, turn the thermostat down to 65 degrees.” She actually said that a warm room can induce nightmares.

I got up and jaunted to the thermostat, changing it from 73 to 65. Done.

There were other tips that came to mind as I lay there in bed, the bustle of Bangkok happening just down below me. One was to take a warm shower. I already did that as it’s my travel ritual: the first thing I do after a long flight is take a shower.

This was too late for me now, but travelers can actually do something before the trip that might help their first night’s sleep in a hotel. “Plan ahead and start adjusting meal times, sleep schedules, exercise timing and light exposure to your destination several days prior to travel if possible,” said W. Christopher Winter, president at Charlottesville Neurology and Sleep Medicine and author of the book “The Sleep Solution: Why Your Sleep Is Broken and How to Fix It.”

Another thing that I was too late for but an excellent idea, Winter also suggests: “If you use lavender spray at home, bring it on the trip. Spray it on your pillow. The smell will trick your brain into thinking it’s at home.”

Now what to do with that pesky crack in the curtains? In some countries, such as Croatia, five-star hotels are required by law to have curtains that fully black out the windows. Thailand, apparently, is not one of those countries (or this hotel is breaking the law). Robbins suggested bringing clothespins to clamp that irritating gap in the curtains. I had an even better solution. I clipped three pants clothes hangers to the two curtains, thus closing the opening.

And that alarm clock? I didn’t want to unplug it because I had it set to wake me up in eight hours. Robbins suggested an eye mask. I hate sleeping with eye masks, so instead I just took a bath towel, folded three times over and laid it in front of the clock. And just for good measure, I took another bath towel, rolled it up and laid it on the floor behind the door, ensuring no light will sneak in.

And so with all this, I got back into bed and lay there in the complete blackness, which I only achieved thanks to my recently acquired tips.

Eight hours later, I was summoned awake by that annoying alarm clock. I slept through the night, though, and I felt refreshed. Had my hotel hacks helped? I may never really know but a few things were certain: My room was darker and cooler than usual, both of which promote sound sleeping.

“I love sleep,” Ernest Hemingway once said, “My life has a tendency to fall apart when I’m awake, you know?”

I knew exactly what he was talking about. But on this day, very well rested, I’d be able to fully keep it together.