ekmmeters.py
def setHolidayDates(self, cmd_dict=None, password="00000000"):
        """ Serial call to set holiday list.

        If a buffer dictionary is not supplied, the method will use
        the class object buffer populated with assignHolidayDate.

        Args:
            cmd_dict (dict): Optional dictionary of holidays.
            password (str): Optional password.

        Returns:
            bool: True on completion.
        """
        result = False
        self.setContext("setHolidayDates")
        if not cmd_dict:
            cmd_dict = self.m_holiday_date_params

        try:
            if not self.request(False):
                self.writeCmdMsg("Bad read CRC on setting")
            else:
                if not self.serialCmdPwdAuth(password):
                    self.writeCmdMsg("Password failure")
                else:
                    req_table = ""
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_1_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_1_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_2_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_2_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_3_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_3_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_4_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_4_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_5_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_5_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_6_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_6_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_7_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_7_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_8_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_8_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_9_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_9_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_10_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_10_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_11_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_11_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_12_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_12_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_13_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_13_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_14_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_14_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_15_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_15_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_16_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_16_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_17_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_17_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_18_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_18_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_19_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_19_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_20_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_20_Day"]).zfill(2))
                    req_str = "015731023030423028" + req_table + "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(setHolidayDates: 06 returned.")
                        result = True
            self.serialPostEnd()
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        self.setContext("")
        return result
def setHolidayDates(self, cmd_dict=None, password="00000000"):
        """ Serial call to set holiday list.

        If a buffer dictionary is not supplied, the method will use
        the class object buffer populated with assignHolidayDate.

        Args:
            cmd_dict (dict): Optional dictionary of holidays.
            password (str): Optional password.

        Returns:
            bool: True on completion.
        """
        result = False
        self.setContext("setHolidayDates")
        if not cmd_dict:
            cmd_dict = self.m_holiday_date_params

        try:
            if not self.request(False):
                self.writeCmdMsg("Bad read CRC on setting")
            else:
                if not self.serialCmdPwdAuth(password):
                    self.writeCmdMsg("Password failure")
                else:
                    req_table = ""
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_1_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_1_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_2_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_2_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_3_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_3_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_4_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_4_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_5_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_5_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_6_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_6_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_7_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_7_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_8_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_8_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_9_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_9_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_10_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_10_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_11_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_11_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_12_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_12_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_13_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_13_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_14_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_14_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_15_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_15_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_16_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_16_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_17_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_17_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_18_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_18_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_19_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_19_Day"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_20_Month"]).zfill(2))
                    req_table += binascii.hexlify(str(cmd_dict["Holiday_20_Day"]).zfill(2))
                    req_str = "015731023030423028" + req_table + "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(setHolidayDates: 06 returned.")
                        result = True
            self.serialPostEnd()
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        self.setContext("")
        return result
Serial call to set holiday list.

        If a buffer dictionary is not supplied, the method will use
        the class object buffer populated with assignHolidayDate.

        Args:
            cmd_dict (dict): Optional dictionary of holidays.
            password (str): Optional password.

        Returns:
            bool: True on completion.