# Path: mysensors/const.py
# SYSTEM_CHILD_ID = 255
# 
# def get_const(protocol_version):
#     """Return the const module for the protocol_version."""
#     path = next(
#         (
#             CONST_VERSIONS[const_version]
#             for const_version in sorted(CONST_VERSIONS, reverse=True)
#             if parse_ver(protocol_version) >= parse_ver(const_version)
#         ),
#         "mysensors.const_14",
#     )
#     if path in LOADED_CONST:
#         return LOADED_CONST[path]
#     const = import_module(path)
#     LOADED_CONST[path] = const  # Cache the module
#     return const


import logging
import voluptuous as vol
from .const import SYSTEM_CHILD_ID, get_const
                vol.In(
                    [SYSTEM_CHILD_ID],
                    msg=(
                        f"When message type is {self.type}, "
                        f"child_id must be {SYSTEM_CHILD_ID}"
                    ),
                ),
            )
        if self.type == const.MessageType.internal and self.sub_type in [
            const.Internal.I_ID_REQUEST,
            const.Internal.I_ID_RESPONSE,
        ]:
            valid_child_ids = vol.Coerce(int)
        valid_types = vol.All(
            vol.Coerce(int),
            vol.In(
                [member.value for member in const.VALID_MESSAGE_TYPES],
                msg=f"Not valid message type: {self.type}",
            ),
        )
        if self.child_id == SYSTEM_CHILD_ID:
            valid_types = vol.All(
                vol.Coerce(int),
                vol.In(
                    [
                        const.MessageType.presentation.value,
                        const.MessageType.internal.value,
                        const.MessageType.stream.value,
                    ],
                    msg=(

# Path: mysensors/const.py
# SYSTEM_CHILD_ID = 255
# 
# def get_const(protocol_version):
#     """Return the const module for the protocol_version."""
#     path = next(
#         (
#             CONST_VERSIONS[const_version]
#             for const_version in sorted(CONST_VERSIONS, reverse=True)
#             if parse_ver(protocol_version) >= parse_ver(const_version)
#         ),
#         "mysensors.const_14",
#     )
#     if path in LOADED_CONST:
#         return LOADED_CONST[path]
#     const = import_module(path)
#     LOADED_CONST[path] = const  # Cache the module
#     return const


# Path: mysensors/message.py
import logging
import voluptuous as vol
from .const import SYSTEM_CHILD_ID, get_const

                vol.In(
                    [SYSTEM_CHILD_ID],
                    msg=(
                        f"When message type is {self.type}, "
                        f"child_id must be {SYSTEM_CHILD_ID}"
                    ),
                ),
            )
        if self.type == const.MessageType.internal and self.sub_type in [
            const.Internal.I_ID_REQUEST,
            const.Internal.I_ID_RESPONSE,
        ]:
            valid_child_ids = vol.Coerce(int)
        valid_types = vol.All(
            vol.Coerce(int),
            vol.In(
                [member.value for member in const.VALID_MESSAGE_TYPES],
                msg=f"Not valid message type: {self.type}",
            ),
        )
        if self.child_id == SYSTEM_CHILD_ID:
            valid_types = vol.All(
                vol.Coerce(int),
                vol.In(
                    [
                        const.MessageType.presentation.value,
                        const.MessageType.internal.value,
                        const.MessageType.stream.value,
                    ],
                    msg=(

                        f"When child_id is {SYSTEM_CHILD_ID}, "