]> gitweb.maison.local Git - pyowl.git/commitdiff
cleaned code of CM160 object
authorLionel <lionel@ra.enneade.fdn.org>
Tue, 18 Nov 2014 14:24:48 +0000 (15:24 +0100)
committerLionel <lionel@ra.enneade.fdn.org>
Tue, 18 Nov 2014 14:24:48 +0000 (15:24 +0100)
cm160Server.py

index 8525a51b3152a43320074a1094d740c63fc14023..31eaed235df5c876932be4e439d22705adfdd5a1 100755 (executable)
@@ -317,10 +317,6 @@ class CM160:
        and saves them via a DataStore object.
   """
   
-  DEFAULT_WINDOWS_LOGFILE      = "C:\\owl_server_log.txt"
-  DEFAULT_NON_WINDOWS_LOGFILE = "/var/log/owl_server_log.txt"
-
-  DEFAULT_SERVER_PORT = 12745
   DEVICE_NAME = "OWL+USB (CM160)"
   
   MESSAGE_ID_0 = 0xa9
@@ -373,9 +369,7 @@ class CM160:
     
   def openSerialPort(self):
     """Open a serial port with the required settings
-       Returns the seialPort object or None if an error occured opening the 
-       serial port.
-    """
+       Returns the serialPort object or None if an error occured opening the serial port. """
     #Ifthe serial port is open, close it
     if self.__ser != None:
        self.__ser.close()
@@ -408,7 +402,7 @@ class CM160:
       self.__serRXBuffer = self.__serRXBuffer + list(buf)
 
   def getSerialPortPacket(self, timeoutSeconds=60):
-      """Get the next 11 byte message an OWL+USB device
+      """Get the next 11 bytes message of an OWL+USB device
          Returns a list object holding the message (string elements) or None 
          if a timeout occured while waiting for a message.
       """
@@ -447,7 +441,7 @@ class CM160:
       self.__uo.debug("TX: %03d/0x%02x" % (b,b) )
          
   def processSerialPacket(self, packet, realTimeData):
-    """Process an 11 byte packet containing sensor data"""
+    """Process an 11 bytes packet containing sensor data"""
     if len(packet) != 11:
       raise OWLError("Invalid data message length. 11 bytes expected, got %d" % (len(packet)) )
     #Convert strings to list of numbers
@@ -477,7 +471,6 @@ class CM160:
     day = frame[3]
     hour = frame[4]
     _min = frame[5]
-#    costPerKWH = (frame[6]+(frame[7]<<8))/100.0 #Cost in pence per kWh
     amps = (frame[8]+(frame[9]<<8))* 0.07       #Conversion factor to Amps
     cm160Data = CM160Data(_min, hour, day, month, year, amps)
     #Set flag to indicate if this CM160Data was read in realtime or during a data download
@@ -546,9 +539,6 @@ class CM160:
       self.__ser.close()
       self.__uo.info("%s closed" % (self.__serialPortName) )
 
-#    if self.__server != None:
-#      self.__server.stop()
-      
     if self.__queueReader != None:
       self.__queueReader.stop()