Added detection of disconnected state and set up reconnection handling for it. (my tag will disconnect if I cup it in my hands 5 feet from my pi)
Added optional pexpect logging to a file, so you can see what's actually going on by tailing it.
Moved some stuff into methods
Added ambient temp to the csv file, because I wanted it in my fridge.  (don't know how to convert it though.)