added test mode to sensor.py