diff --git a/aioesphomeapi/_frame_helper.py b/aioesphomeapi/_frame_helper.py index 1020cd5..e1acb91 100644 --- a/aioesphomeapi/_frame_helper.py +++ b/aioesphomeapi/_frame_helper.py @@ -4,6 +4,7 @@ import logging from abc import abstractmethod from enum import Enum from functools import partial +from struct import Struct from typing import TYPE_CHECKING, Any, Callable, Optional, cast import async_timeout @@ -34,12 +35,19 @@ SOCKET_ERRORS = ( TimeoutError, ) +PACK_NONCE = partial(Struct(" bytes: + return PACK_NONCE(n) + class ESPHomeNoiseBackend(DefaultNoiseBackend): # type: ignore[misc] def __init__(self, *args: Any, **kwargs: Any) -> None: