I suppose it depends on which traffic light model you are using... The only traffic light that I am aware of was in citysim (plugin and world example), which may do what you need but might need some modification for gazebo-11.