add sensorstate function