Get Tracked Device Position and Orientation

Sup guys! I’m trying to make a tracked camera using a vive controller using this setup:

It does work sometimes, but it’s not constant. Very often “Device id” changes, forcing me to start over with rigorous testing until it works like magic. My question is: how do I see the Device id’s available so I can make the process of choosing “Device id” automatic? Is there a better way to do this?