Automation for multiple devices of same type

I have automations for doors and lights which are all identical except for the device involved. It would be great to be able to have one automation which allow matching up pairs of triggers to actions. ie. Door Sensor to light. Or device to announcement where the announcement pics up the friendly name of the device which triggered