Nest thermostat automation help

I would like to build an automation that turns a Nest thermostat mode to off when moisture is detected by a flood sensor. Is this possible?