ekmmeters.py
def extractSchedule(self, schedule, period):
        """ Read a single schedule tariff from meter object buffer.

        Args:
            schedule (int): A :class:`~ekmmeters.Schedules` value or in range(Extent.Schedules).
            tariff (int): A :class:`~ekmmeters.Tariffs` value or in range(Extent.Tariffs).

        Returns:
            bool: True on completion.
        """
        ret = namedtuple("ret", ["Hour", "Min", "Tariff", "Period", "Schedule"])
        work_table = self.m_schd_1_to_4
        if Schedules.Schedule_5 <= schedule <= Schedules.Schedule_6:
            work_table = self.m_schd_5_to_6
        period += 1
        schedule += 1
        ret.Period = str(period)
        ret.Schedule = str(schedule)
        if (schedule < 1) or (schedule > Extents.Schedules) or (period < 0) or (period > Extents.Periods):
            ekm_log("Out of bounds: tariff " + str(period) + " for schedule " + str(schedule))
            ret.Hour = ret.Min = ret.Tariff = str(0)
            return ret

        idxhr = "Schedule_" + str(schedule) + "_Period_" + str(period) + "_Hour"
        idxmin = "Schedule_" + str(schedule) + "_Period_" + str(period) + "_Min"
        idxrate = "Schedule_" + str(schedule) + "_Period_" + str(period) + "_Tariff"

        if idxhr not in work_table:
            ekm_log("Incorrect index: " + idxhr)
            ret.Hour = ret.Min = ret.Tariff = str(0)
            return ret

        if idxmin not in work_table:
            ekm_log("Incorrect index: " + idxmin)
            ret.Hour = ret.Min = ret.Tariff = str(0)
            return ret

        if idxrate not in work_table:
            ekm_log("Incorrect index: " + idxrate)
            ret.Hour = ret.Min = ret.Tariff = str(0)
            return ret

        ret.Hour = work_table[idxhr][MeterData.StringValue]
        ret.Min = work_table[idxmin][MeterData.StringValue].zfill(2)
        ret.Tariff = work_table[idxrate][MeterData.StringValue]
        return ret
def extractSchedule(self, schedule, period):
        """ Read a single schedule tariff from meter object buffer.

        Args:
            schedule (int): A :class:`~ekmmeters.Schedules` value or in range(Extent.Schedules).
            tariff (int): A :class:`~ekmmeters.Tariffs` value or in range(Extent.Tariffs).

        Returns:
            bool: True on completion.
        """
        ret = namedtuple("ret", ["Hour", "Min", "Tariff", "Period", "Schedule"])
        work_table = self.m_schd_1_to_4
        if Schedules.Schedule_5 <= schedule <= Schedules.Schedule_6:
            work_table = self.m_schd_5_to_6
        period += 1
        schedule += 1
        ret.Period = str(period)
        ret.Schedule = str(schedule)
        if (schedule < 1) or (schedule > Extents.Schedules) or (period < 0) or (period > Extents.Periods):
            ekm_log("Out of bounds: tariff " + str(period) + " for schedule " + str(schedule))
            ret.Hour = ret.Min = ret.Tariff = str(0)
            return ret

        idxhr = "Schedule_" + str(schedule) + "_Period_" + str(period) + "_Hour"
        idxmin = "Schedule_" + str(schedule) + "_Period_" + str(period) + "_Min"
        idxrate = "Schedule_" + str(schedule) + "_Period_" + str(period) + "_Tariff"

        if idxhr not in work_table:
            ekm_log("Incorrect index: " + idxhr)
            ret.Hour = ret.Min = ret.Tariff = str(0)
            return ret

        if idxmin not in work_table:
            ekm_log("Incorrect index: " + idxmin)
            ret.Hour = ret.Min = ret.Tariff = str(0)
            return ret

        if idxrate not in work_table:
            ekm_log("Incorrect index: " + idxrate)
            ret.Hour = ret.Min = ret.Tariff = str(0)
            return ret

        ret.Hour = work_table[idxhr][MeterData.StringValue]
        ret.Min = work_table[idxmin][MeterData.StringValue].zfill(2)
        ret.Tariff = work_table[idxrate][MeterData.StringValue]
        return ret
Read a single schedule tariff from meter object buffer.

        Args:
            schedule (int): A :class:`~ekmmeters.Schedules` value or in range(Extent.Schedules).
            tariff (int): A :class:`~ekmmeters.Tariffs` value or in range(Extent.Tariffs).

        Returns:
            bool: True on completion.