It’s easy to save energy in hotel rooms by turning off heating and air conditioning when they’re empty. But messing with the temperature in occupied rooms is likely to lead to a lot of complaints, even if it does save tons of energy.

Enter Telkonet, which says it has hit the sweet spot for shaving energy from booked rooms when guests are away, without annoying guests when they return. Think of it as the Goldilocks formula: not too hot and not too cold.

The Milwaukee, Wisc.-based company does it with ZigBee-networked, extra-smart thermostats capable of sensing and adjusting temperatures on an ongoing basis, and never letting the temperature drift outside a threshold that can allow it to come back to the guests's setting when the guest returns -- barely long enough for them to take off their jackets, let alone start messing with the thermostat.

Backing that up is a software platform that absorbs the 130-plus variables such as room humidity, time of day, outside lighting, weather conditions and other factors, CEO Jason Tienor told me in an interview last week. Telkonet connects to room thermostats, wall sockets, light switches and appliances and adjusts according to occupancy, events, building automation scheduling and utility programs, he said.

To be sure, Telkonet, which is traded over the counter under the symbol TKOI, has seen its share of ups and downs, and has been trading at pennies per share for some time. But the company has turned steady losses into small profits over the past few quarters (PDF), and it has a long list of new projects and that could give its technology the proving points it needs to gain more traction.

Telkonet was founded in 1999 as a powerline carrier technology company, but has since sold off that part of the business, Tienor said. In 2007, it bought Milwaukee, Wisc.-based EthoStream -- whose hotel high-speed internet networking business now makes up Telkonet's networking platform -- and Las Vegas-based Smart Systems International, which provided the core of Telkonet’s EcoSmart product line, he said.

From the first, the company wanted to go beyond the simple, set-and-forget “smart” thermostats now used for most hotels, Tienor said. The problem with today’s room-by-room energy controls, he said, is that they can waste as much energy as they save.

That’s because most of today’s “smart” thermostats simply allow room temperature to drift between wide set-points -- say, 60 degrees to 80 degrees -- without taking the impact of other variables into account like outside weather. When these thermostats sense a guest’s return and slam on the heat or the air conditioning, that tends to put the HVAC system into overdrive, which can actually waste more energy than whatever was saved by letting the temperature drift.

To tackle that challenge, Telkonet builds in the “recovery time” needed for automatic thermostats to restore room temperatures to guests' settings when they left the room, he said. That means a softer, gentler ramp-up of the HVAC system, as well as a more pleasing experience for the guest, he noted.

Telkonet’s data-rich system does require a thermostat with a bit more processing power and memory than the typical automated, “set-and-forget” model, he said. Telkonet runs the systems over its EcoCentral cloud-based platform, which it provides on a turnkey basis, as well as a hosted service, but the company's “thermostats carry all the intelligence and log all their savings on board” as well.

Maintaining constant network connections to thermostats and other devices allows Telkonet to adjust them in near-real time, which gives the company the ability to do demand response and load control -- something it’s doing for New York University in dorm rooms, among other projects, Tienor said.

It’s a bit like the kind of automated energy optimization that’s being attempted by startups like BuildingIQ or Siemens acquisition SureGrid in the commercial building space. Indeed, tenant comfort has been one of the big barriers to more widespread heating and cooling controls in both hotel rooms and office spaces. On the home energy front, startup EcoFactor is working on similar hands-free, comfort-first thermostat tweaking for utilities.

Still, balancing efficiency and comfort with thermostats is a tricky and expensive proposition, requiring plenty of upfront investment and ongoing management. Telkonet and others that are trying it out will have to prove they can keep Goldilocks happy before their technology takes off.