From a137138d080a8e66d4a764157d6cad17ef0ab57b Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Sat, 10 Oct 2026 12:48:38 -0400 Subject: [PATCH] Add path to yaml files This will allow other docker images, such as linuxserver's to pass on the path to the config file, since it is different from the official image. --- pyhilo/api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyhilo/api.py b/pyhilo/api.py index 942b769..93dcbd9 100755 --- a/pyhilo/api.py +++ b/pyhilo/api.py @@ -65,11 +65,12 @@ def __init__( oauth_session: OAuth2Session, request_retries: int = REQUEST_RETRY, log_traces: bool = False, + state_yaml: str = DEFAULT_STATE_FILE, ) -> None: """Initialize""" self._backoff_refresh_lock_api = asyncio.Lock() self._request_retries = request_retries - self._state_yaml: str = DEFAULT_STATE_FILE + self._state_yaml: str = state_yaml self.state: StateDict = {} self.async_request = self._wrap_request_method(self._request_retries) self.device_attributes = get_device_attributes() @@ -92,6 +93,7 @@ async def async_create( oauth_session: OAuth2Session, request_retries: int = REQUEST_RETRY, log_traces: bool = False, + state_yaml: str = DEFAULT_STATE_FILE, ) -> API: """Get an authenticated API object. :param session: The ``aiohttp`` ``ClientSession`` session used for all HTTP requests @@ -100,6 +102,7 @@ async def async_create( :type oauth_session: ``config_entry_oauth2_flow.OAuth2Session`` :param request_retries: The default number of request retries to use :type request_retries: ``int`` + :param state_yaml: Path of the file where the API state (tokens, etc.) is saved. :rtype: :meth:`pyhilo.api.API` """ api = cls( @@ -107,6 +110,7 @@ async def async_create( oauth_session=oauth_session, request_retries=request_retries, log_traces=log_traces, + state_yaml=state_yaml, ) # Test token before post init await api.async_get_access_token()