Fix minor race condition
Created by: mattclarke
Can get an error warning about self._pv_name not being defined if monitor_callback happens before the value is defined. Simple fix is to move the assignment up before trying to create the monitor.
Some of the other variables are used in the callback too, so I've moved them all up too.