(self, data, timestamp=None, verbose=False)
Initializes packet data. Sets the global battery value.
        Updates each sensor with current sensor value from the packet data.

        :param data - Values decrypted to be processed
        :param verbose - Flag for outputting debug values.
Initializes packet data. Sets the global battery value.
        Updates each sensor with current sensor value from the packet data.
Initializes packet data . Sets the global battery value . Updates each sensor with current sensor value from the packet data .
def __init__(self, data, timestamp=None, verbose=False):
        """
        Initializes packet data. Sets the global battery value.
        Updates each sensor with current sensor value from the packet data.

        :param data - Values decrypted to be processed
        :param verbose - Flag for outputting debug values.
        """

        if timestamp is None:
            self.timestamp = datetime.now()
        else:
            self.timestamp = timestamp
        if sys.version_info >= (3, 0):
            self.raw_data = [int(byte) for byte in data]
            data = self.raw_data
            self.counter = data[0]
        else:
            if type(data[0]) == str and len(data) > 1:
                self.raw_data = [ord(byte) for byte in data]
                data = self.raw_data
            else:
                self.raw_data = data
            self.counter = data[0]
        self.battery = None

        self.sync = self.counter == 0xe9
        self.sensors = sensors_mapping.copy()

        for name, sensor_bytes in sensors_16_bytes.items():
            # if sys.version_info >= (3, 0):
            whole, precision = self.raw_data[sensor_bytes[1]], self.raw_data[sensor_bytes[0]]
            whole = whole / 0.031
            # print(whole)
            precision = precision / 3.1
            # print(precision)
            value = whole + precision
            # print(value)
            setattr(self, name, (value,))
            self.sensors[name]['value'] = value
def __init__ ( self , data , timestamp = None , verbose = False ) : if timestamp is None : self . timestamp = datetime . now ( ) else : self . timestamp = timestamp if sys . version_info >= ( 3 , 0 ) : self . raw_data = [ int ( byte ) for byte in data ] data = self . raw_data self . counter = data [ 0 ] else : if type ( data [ 0 ] ) == str and len ( data ) > 1 : self . raw_data = [ ord ( byte ) for byte in data ] data = self . raw_data else : self . raw_data = data self . counter = data [ 0 ] self . battery = None self . sync = self . counter == 0xe9 self . sensors = sensors_mapping . copy ( ) for name , sensor_bytes in sensors_16_bytes . items ( ) : # if sys.version_info >= (3, 0): whole , precision = self . raw_data [ sensor_bytes [ 1 ] ] , self . raw_data [ sensor_bytes [ 0 ] ] whole = whole / 0.031 # print(whole) precision = precision / 3.1 # print(precision) value = whole + precision # print(value) setattr ( self , name , ( value , ) ) self . sensors [ name ] [ 'value' ] = value