commit a7721fb9ff6ad052157513cec5dc9db4e14c6d8b
Author: David Sorber <dsorber@dm1z.(none)>
Date:   Sun May 5 14:36:54 2013 -0400

    Fixing a bug that I just noticed while doing a dry run.  The client sorts the temps before creating the SensorReading object so the correct temps don't correspond to the correct sensors on the server. The fix was simply to create the SensorReading object sooner before the temps are sorted.

diff --git a/525.743/code/rpi_client.py b/525.743/code/rpi_client.py
index 9961e33..c241993 100644
--- a/525.743/code/rpi_client.py
+++ b/525.743/code/rpi_client.py
@@ -160,6 +160,10 @@ def main():
 			for idx in xrange(NUM_SENSORS):
 				print '\t Sensor %d: %d' % (idx + 1, temps[idx])
 
+		# Create the SensorReading object before we sort the temps
+		reading = SensorReading(now, temps[0], temps[1], temps[2],
+								temps[3], relay_state)
+
 		# Sort all the temperature readings for easier manipulation
 		temps.sort(reverse=True)
 
@@ -182,8 +186,6 @@ def main():
 			if DEBUG:
 				print 'Sending reading to server...',
 				sys.stdout.flush()
-			reading = SensorReading(now, temps[0], temps[1], temps[2],
-									temps[3], relay_state)
 			try:
 				s.sendall(cPickle.dumps(reading))
 				if DEBUG:
