How does the DUPLO Action Bricks work?
It is about color and length 

The Duplo action brick uses a color sensor, so you want to use the correct colors
and it needs the length of the brick for the sensor to determine the color.

paper replacement (youtube)

How to 3d print your own