ekmmeters.py
def readSchedules(self, tableset):
        """ Serial call to read schedule tariffs buffer

        Args:
            tableset (int): :class:`~ekmmeters.ReadSchedules` buffer to return.

        Returns:
            bool: True on completion and ACK.
        """
        self.setContext("readSchedules")
        try:
            req_table = binascii.hexlify(str(tableset).zfill(1))
            req_str = "01523102303037" + req_table + "282903"

            self.request(False)
            req_crc = self.calc_crc16(req_str[2:].decode("hex"))
            req_str += req_crc
            self.m_serial_port.write(req_str.decode("hex"))
            raw_ret = self.m_serial_port.getResponse(self.getContext())
            self.serialPostEnd()
            return_crc = self.calc_crc16(raw_ret[1:-2])

            if tableset == ReadSchedules.Schedules_1_To_4:
                unpacked_read = self.unpackStruct(raw_ret, self.m_schd_1_to_4)
                self.convertData(unpacked_read, self.m_schd_1_to_4, self.m_kwh_precision)
                if str(return_crc) == str(self.m_schd_1_to_4["crc16"][MeterData.StringValue]):
                    ekm_log("Schedules 1 to 4 CRC success (06 return")
                    self.setContext("")
                    return True

            elif tableset == ReadSchedules.Schedules_5_To_6:
                unpacked_read = self.unpackStruct(raw_ret, self.m_schd_5_to_6)
                self.convertData(unpacked_read, self.m_schd_5_to_6, self.m_kwh_precision)
                if str(return_crc) == str(self.m_schd_5_to_6["crc16"][MeterData.StringValue]):
                    ekm_log("Schedules 5 to 8 CRC success (06 return)")
                    self.setContext("")
                    return True
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        self.setContext("")
        return False
def readSchedules(self, tableset):
        self.setContext("readSchedules")
        try:
            req_table = binascii.hexlify(str(tableset).zfill(1))
            req_str = "01523102303037" + req_table + "282903"

            self.request(False)
            req_crc = self.calc_crc16(req_str[2:].decode("hex"))
            req_str += req_crc
            self.m_serial_port.write(req_str.decode("hex"))
            raw_ret = self.m_serial_port.getResponse(self.getContext())
            self.serialPostEnd()
            return_crc = self.calc_crc16(raw_ret[1:-2])

            if tableset == ReadSchedules.Schedules_1_To_4:
                unpacked_read = self.unpackStruct(raw_ret, self.m_schd_1_to_4)
                self.convertData(unpacked_read, self.m_schd_1_to_4, self.m_kwh_precision)
                if str(return_crc) == str(self.m_schd_1_to_4["crc16"][MeterData.StringValue]):
                    ekm_log("Schedules 1 to 4 CRC success (06 return")
                    self.setContext("")
                    return True

            elif tableset == ReadSchedules.Schedules_5_To_6:
                unpacked_read = self.unpackStruct(raw_ret, self.m_schd_5_to_6)
                self.convertData(unpacked_read, self.m_schd_5_to_6, self.m_kwh_precision)
                if str(return_crc) == str(self.m_schd_5_to_6["crc16"][MeterData.StringValue]):
                    ekm_log("Schedules 5 to 8 CRC success (06 return)")
                    self.setContext("")
                    return True
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        self.setContext("")
        return False
def readSchedules ( self , tableset ) : self . setContext ( "readSchedules" ) try : req_table = binascii . hexlify ( str ( tableset ) . zfill ( 1 ) ) req_str = "01523102303037" + req_table + "282903" self . request ( False ) req_crc = self . calc_crc16 ( req_str [ 2 : ] . decode ( "hex" ) ) req_str += req_crc self . m_serial_port . write ( req_str . decode ( "hex" ) ) raw_ret = self . m_serial_port . getResponse ( self . getContext ( ) ) self . serialPostEnd ( ) return_crc = self . calc_crc16 ( raw_ret [ 1 : - 2 ] ) if tableset == ReadSchedules . Schedules_1_To_4 : unpacked_read = self . unpackStruct ( raw_ret , self . m_schd_1_to_4 ) self . convertData ( unpacked_read , self . m_schd_1_to_4 , self . m_kwh_precision ) if str ( return_crc ) == str ( self . m_schd_1_to_4 [ "crc16" ] [ MeterData . StringValue ] ) : ekm_log ( "Schedules 1 to 4 CRC success (06 return" ) self . setContext ( "" ) return True elif tableset == ReadSchedules . Schedules_5_To_6 : unpacked_read = self . unpackStruct ( raw_ret , self . m_schd_5_to_6 ) self . convertData ( unpacked_read , self . m_schd_5_to_6 , self . m_kwh_precision ) if str ( return_crc ) == str ( self . m_schd_5_to_6 [ "crc16" ] [ MeterData . StringValue ] ) : ekm_log ( "Schedules 5 to 8 CRC success (06 return)" ) self . setContext ( "" ) return True except : ekm_log ( traceback . format_exc ( sys . exc_info ( ) ) ) self . setContext ( "" ) return False
Serial call to read schedule tariffs buffer

        Args:
            tableset (int): :class:`~ekmmeters.ReadSchedules` buffer to return.

        Returns:
            bool: True on completion and ACK.
Serial call to read schedule tariffs buffer