diff --git a/e3dc/_e3dc.py b/e3dc/_e3dc.py index 8aac428..ab859ed 100644 --- a/e3dc/_e3dc.py +++ b/e3dc/_e3dc.py @@ -461,7 +461,20 @@ def get_idle_periods(self, keepAlive: bool = False): (RscpTag.EMS_REQ_GET_IDLE_PERIODS, RscpType.NoneType, None), keepAlive=keepAlive, ) - if idlePeriodsRaw[0] != RscpTag.EMS_GET_IDLE_PERIODS: + + raw = idlePeriodsRaw[0] + + if isinstance(raw, RscpTag): + tag = raw + elif isinstance(raw, str): + try: + tag = RscpTag[raw] + except KeyError: + return None + else: + return None + + if tag != RscpTag.EMS_GET_IDLE_PERIODS: return None idlePeriods: dict[str, list[dict[str, Any]]] = { @@ -664,8 +677,8 @@ def set_idle_periods( else: raise TypeError("period in " + idle_type + " is not a dict") - else: - raise TypeError(idle_type + " is not a dict") + else: + raise TypeError(idle_type + " is not a dict") result = self.sendRequest( (RscpTag.EMS_REQ_SET_IDLE_PERIODS, RscpType.Container, periodList),