ekmmeters.py
def setMaxDemandPeriod(self, period, password="00000000"):
        """ Serial call to set max demand period.

        Args:
            period (int): : as int.
            password (str): Optional password.

        Returns:
            bool: True on completion with ACK.
        """
        result = False
        self.setContext("setMaxDemandPeriod")
        try:
            if period < 1 or period > 3:
                self.writeCmdMsg("Correct parameter: 1 = 15 minute, 2 = 30 minute, 3 = hour")
                self.setContext("")
                return result

            if not self.request(False):
                self.writeCmdMsg("Bad read CRC on setting")
            else:
                if not self.serialCmdPwdAuth(password):
                    self.writeCmdMsg("Password failure")
                else:
                    req_str = "015731023030353028" + binascii.hexlify(str(period)).zfill(2) + "2903"
                    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(setMaxDemandPeriod): 06 returned.")
                        result = True
            self.serialPostEnd()
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        self.setContext("")
        return result
def setMaxDemandPeriod(self, period, password="00000000"):
        result = False
        self.setContext("setMaxDemandPeriod")
        try:
            if period < 1 or period > 3:
                self.writeCmdMsg("Correct parameter: 1 = 15 minute, 2 = 30 minute, 3 = hour")
                self.setContext("")
                return result

            if not self.request(False):
                self.writeCmdMsg("Bad read CRC on setting")
            else:
                if not self.serialCmdPwdAuth(password):
                    self.writeCmdMsg("Password failure")
                else:
                    req_str = "015731023030353028" + binascii.hexlify(str(period)).zfill(2) + "2903"
                    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(setMaxDemandPeriod): 06 returned.")
                        result = True
            self.serialPostEnd()
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        self.setContext("")
        return result
def setMaxDemandPeriod ( self , period , password = "00000000" ) : result = False self . setContext ( "setMaxDemandPeriod" ) try : if period < 1 or period > 3 : self . writeCmdMsg ( "Correct parameter: 1 = 15 minute, 2 = 30 minute, 3 = hour" ) self . setContext ( "" ) return result if not self . request ( False ) : self . writeCmdMsg ( "Bad read CRC on setting" ) else : if not self . serialCmdPwdAuth ( password ) : self . writeCmdMsg ( "Password failure" ) else : req_str = "015731023030353028" + binascii . hexlify ( str ( period ) ) . zfill ( 2 ) + "2903" 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(setMaxDemandPeriod): 06 returned." ) result = True self . serialPostEnd ( ) except : ekm_log ( traceback . format_exc ( sys . exc_info ( ) ) ) self . setContext ( "" ) return result
Serial call to set max demand period.

        Args:
            period (int): : as int.
            password (str): Optional password.

        Returns:
            bool: True on completion with ACK.
Serial call to set max demand period .