ekmmeters.py
def setZeroResettableKWH(self, password="00000000"):
        """ Serial call to zero resettable kWh registers.

        Args:
            password (str): Optional password.

        Returns:
            bool: True on completion and ACK.
        """
        result = False
        self.setContext("setZeroResettableKWH")
        try:
            if not self.requestA():
                self.writeCmdMsg("Bad read CRC on setting")
            else:
                if not self.serialCmdPwdAuth(password):
                    self.writeCmdMsg("Password failure")
                else:
                    req_str = "0157310230304433282903"
                    req_str += self.calc_crc16(req_str[2:].decode("hex"))
                    self.m_serial_port.write(req_str.decode("hex"))
                    if self.m_serial_port.getResponse(self.getContext()).encode("hex") == "06":
                        self.writeCmdMsg("Success: 06 returned.")
                        result = True
            self.serialPostEnd()
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        self.setContext("")
        return result
def setZeroResettableKWH(self, password="00000000"):
        result = False
        self.setContext("setZeroResettableKWH")
        try:
            if not self.requestA():
                self.writeCmdMsg("Bad read CRC on setting")
            else:
                if not self.serialCmdPwdAuth(password):
                    self.writeCmdMsg("Password failure")
                else:
                    req_str = "0157310230304433282903"
                    req_str += self.calc_crc16(req_str[2:].decode("hex"))
                    self.m_serial_port.write(req_str.decode("hex"))
                    if self.m_serial_port.getResponse(self.getContext()).encode("hex") == "06":
                        self.writeCmdMsg("Success: 06 returned.")
                        result = True
            self.serialPostEnd()
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        self.setContext("")
        return result
def setZeroResettableKWH ( self , password = "00000000" ) : result = False self . setContext ( "setZeroResettableKWH" ) try : if not self . requestA ( ) : self . writeCmdMsg ( "Bad read CRC on setting" ) else : if not self . serialCmdPwdAuth ( password ) : self . writeCmdMsg ( "Password failure" ) else : req_str = "0157310230304433282903" req_str += self . calc_crc16 ( req_str [ 2 : ] . decode ( "hex" ) ) self . m_serial_port . write ( req_str . decode ( "hex" ) ) if self . m_serial_port . getResponse ( self . getContext ( ) ) . encode ( "hex" ) == "06" : self . writeCmdMsg ( "Success: 06 returned." ) result = True self . serialPostEnd ( ) except : ekm_log ( traceback . format_exc ( sys . exc_info ( ) ) ) self . setContext ( "" ) return result
Serial call to zero resettable kWh registers.

        Args:
            password (str): Optional password.

        Returns:
            bool: True on completion and ACK.
Serial call to zero resettable kWh registers .