Easiest way is to create a grouped device and let its status drive any automation logic.
This screen shot is from a Sensor Groups+ lock group device: