the warning light has its own voltage regulator and can be operated with 12 to 24V (colored cable, usually the red one)
The controller needs 5V, so you have to add another voltage regulator for 5V. Because of the high voltage difference a small switching regulator is needed, which can do 12-24V at the input and 5V at the output. The current requirement is max. 200mA.
Connection:
Input of the 5V switching regulator ↔ to 12-24V which also goes to the traffic light.
Output of the 5V switching regulator ↔ to the pins 5V and GND of the ESP8266 controller.