Multi-instance handling for sensors

This adds proper multi-instance handling and counts from zero as most systems do.
This misses checking for primary or secondary.