diff --git a/midealocal/message.py b/midealocal/message.py index 1f7893ee..024b69fa 100644 --- a/midealocal/message.py +++ b/midealocal/message.py @@ -1,8 +1,9 @@ """Midea local message.""" import logging +import warnings from enum import IntEnum -from typing import Generic, SupportsIndex, TypeVar, cast +from typing import Any, Generic, SupportsIndex, TypeVar, cast from midealocal.const import DeviceType @@ -270,6 +271,32 @@ class ListTypes(IntEnum): X9F = 0x9F +class BodyType(IntEnum): + """Body Types (Deprecated).""" + + @classmethod + def _missing_(cls, value: Any) -> IntEnum: # noqa: ANN401 + warnings.warn( + "BodyType is deprecated, use ListTypes instead.", + DeprecationWarning, + stacklevel=2, + ) + return ListTypes(value) + + +class SubBodyType(IntEnum): + """SubBody Types (Deprecated).""" + + @classmethod + def _missing_(cls, value: Any) -> IntEnum: # noqa: ANN401 + warnings.warn( + "SubBodyType is deprecated, use ListTypes instead.", + DeprecationWarning, + stacklevel=2, + ) + return ListTypes(value) + + class MessageLenError(Exception): """Message length exception."""