It is not a perfect situation, the relationship between coyote tobacco and hawkmoths.

Sure, the hawkmoth does a good job of pollinating the plant, Nicotiana attenuata, which grows in the Western United States and flowers at night. But the hawkmoth has this habit of leaving behind its eggs, which develop into caterpillars that like nothing better than to eat the plant.

So N. attenuata strikes back in a novel way, according to scientists at the Max Planck Institute for Chemical Ecology in Jena, Germany. As they describe in Current Biology, it shifts the time of its flowering to mornings and attracts a different pollinator, a hummingbird.

“Nobody had actually noticed this before,” said Ian T. Baldwin, director of the institute and senior author of the Current Biology paper. He said Danny Kessler, the lead author, was taking photographs one day of a plant that happened to be attacked by caterpillars. “Out of the blue, the flowers opened in the morning,” he said.

Munching caterpillars produce oral secretions that “activate a whole series of defense responses,” Dr. Baldwin said, including the production of toxins and protease inhibitors that decrease the caterpillars’ digestive ability. The change in flowering time, he said, “is a fourth major group of events that are activated by caterpillar attack.”