Multi-instance handling for sensors

This adds proper multi-instance handling and counts from zero as most systems do.