The link below should give you the clues needed to right your automations.
Use the combined contact sensor as your precondition and weather (rain) as the trigger.