Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update aioairzone-cloud to v0.4.5 #112034

Merged
merged 1 commit into from Mar 2, 2024

Conversation

Noltari
Copy link
Contributor

@Noltari Noltari commented Mar 2, 2024

Proposed change

Update aioairzone-cloud to v0.4.5.

The library now uses the new WebSockets functionality to reduce the number of API calls.
This is a first stage to reduce the number of API calls, but in a future PR I’ll add a callback for WebSockets updates and the integration will become Cloud Push instead of Cloud Polling.

Releases:

Git compare: Noltari/aioairzone-cloud@0.3.8...0.4.5

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
@Noltari Noltari changed the title Airzone cloud v0.4.5 Update aioairzone-cloud to v0.4.5 Mar 2, 2024
@jpbede jpbede added this to the 2024.3.0 milestone Mar 2, 2024
@jpbede jpbede merged commit 61e2829 into home-assistant:dev Mar 2, 2024
53 checks passed
balloob pushed a commit that referenced this pull request Mar 2, 2024
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
@bdraco
Copy link
Member

bdraco commented Mar 2, 2024

CI is failing sometimes after this PR was merged

Looks like unmocked I/O somewhere

@bdraco
Copy link
Member

bdraco commented Mar 2, 2024

------------------------------------------------------------------------------------------------------------------- Captured stdout teardown -------------------------------------------------------------------------------------------------------------------
['create_task',
 <coroutine object _wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.finalizer.<locals>.async_finalizer at 0x1092385f0>,
 None]
['create_task',
 <coroutine object DataUpdateCoordinator.async_shutdown at 0x10afb3040>,
 'None Mock Title airzone_cloud d186e31edb46d64d14b9b2f11f1ebd9f']
['create_task',
 <coroutine object BaseEventLoop.shutdown_default_executor at 0x10ad07880>,
 None]
------------------------------------------------------------------------------------------------------------------- Captured stderr teardown -------------------------------------------------------------------------------------------------------------------
WARNING:homeassistant.util.executor:Thread[SyncWorker_0] is still running at shutdown: File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
    work_item.run()
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 883, in _getaddrinfo_debug
    addrinfo = socket.getaddrinfo(host, port, family, type, proto, flags)
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/socket.py", line 963, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
-------------------------------------------------------------------------------------------------------------------- Captured log teardown ---------------------------------------------------------------------------------------------------------------------
2024-03-02 13:41:01.255 WARNING  Thread-1 (_do_shutdown) homeassistant.util.executor:executor.py:29 Thread[SyncWorker_0] is still running at shutdown: File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 92, in _worker
    work_item.run()
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 883, in _getaddrinfo_debug
    addrinfo = socket.getaddrinfo(host, port, family, type, proto, flags)
  File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/socket.py", line 963, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
                                                                                                                                                                                                                                                  17% █▋        

―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ERROR at setup of test_airzone_climate_turn_on_off ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

request = <SubRequest 'hass' for <Coroutine test_airzone_climate_turn_on_off>>, kwargs = {'hass_fixture_setup': [], 'hass_storage': {}, 'load_registries': True}, func = <function hass at 0x10a912c00>
setup = <function _wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup at 0x10d9c51c0>, finalizer = <function _wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.finalizer at 0x10d9c5120>

    @functools.wraps(fixture)
    def _asyncgen_fixture_wrapper(request: SubRequest, **kwargs: Any):
        func = _perhaps_rebind_fixture_func(
            fixture, request.instance, fixturedef.unittest
        )
        event_loop = kwargs.pop(event_loop_fixture_id)
        gen_obj = func(
            **_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
        )
    
        async def setup():
            res = await gen_obj.__anext__()
            return res
    
        def finalizer() -> None:
            """Yield again, to finalize."""
    
            async def async_finalizer() -> None:
                try:
                    await gen_obj.__anext__()
                except StopAsyncIteration:
                    pass
                else:
                    msg = "Async generator fixture didn't stop."
                    msg += "Yield only once."
                    raise ValueError(msg)
    
            event_loop.run_until_complete(async_finalizer())
    
>       result = event_loop.run_until_complete(setup())

venv/lib/python3.12/site-packages/pytest_asyncio/plugin.py:347: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py:673: in run_until_complete
    self.run_forever()
/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py:640: in run_forever
    self._run_once()
/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py:1965: in _run_once
    handle._run()
/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/events.py:84: in _run
    self._context.run(self._callback, *self._args)
venv/lib/python3.12/site-packages/aiohttp/connector.py:1178: in drop_exception
    fut.result()
venv/lib/python3.12/site-packages/aiohttp/connector.py:884: in _resolve_host
    addrs = await self._resolver.resolve(host, port, family=self._family)
venv/lib/python3.12/site-packages/aiohttp/resolver.py:33: in resolve
    infos = await self._loop.getaddrinfo(
/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py:900: in getaddrinfo
    return await self.run_in_executor(
/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py:58: in run
    result = self.fn(*self.args, **self.kwargs)
/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py:883: in _getaddrinfo_debug
    addrinfo = socket.getaddrinfo(host, port, family, type, proto, flags)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

host = 'm.airzonecloud.com', port = 443, family = 0, type = <SocketKind.SOCK_STREAM: 1>, proto = 0, flags = <AddressInfo.AI_ADDRCONFIG: 1024>

    def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
        """Resolve host and port into list of address info entries.
    
        Translate the host/port argument into a sequence of 5-tuples that contain
        all the necessary arguments for creating a socket connected to that service.
        host is a domain name, a string representation of an IPv4/v6 address or
        None. port is a string service name such as 'http', a numeric port number or
        None. By passing None as the value of host and port, you can pass NULL to
        the underlying C API.
    
        The family, type and proto arguments can be optionally specified in order to
        narrow the list of addresses returned. Passing zero as a value for each of
        these arguments selects the full range of results.
        """
        # We override this function since we want to translate the numeric family
        # and socket type values to enum constants.
        addrlist = []
>       for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
E       SystemExit

/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/socket.py:963: SystemExit
-------------------------------------------------------------------------------------------------------------------- Captured stdout setup ---------------------------------------------------------------------------------------------------------------------
['create_task',
 <coroutine object _wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup at 0x10d9b8040>,
 None]
                                                                                                                                                                                                                                                  33% ███▍      
 tests/components/airzone_cloud/test_climate.py ✓✓✓✓                                                                                                                                                                                             100% ██████████
======================================================================================================================= warnings summary =======================================================================================================================
venv/lib/python3.12/site-packages/pytest_asyncio/plugin.py:233
  /Users/bdraco/home-assistant/venv/lib/python3.12/site-packages/pytest_asyncio/plugin.py:233: PytestDeprecationWarning: aresponses is asynchronous and explicitly requests the "event_loop" fixture. Asynchronous fixtures and test functions should use "asyncio.get_running_loop()" instead.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=================================================================================================================== short test summary info ====================================================================================================================
FAILED tests/components/airzone_cloud/test_climate.py::test_airzone_create_climates - SystemExit
FAILED tests/components/airzone_cloud/test_climate.py::test_airzone_climate_turn_on_off - SystemExit

@Noltari
Copy link
Contributor Author

Noltari commented Mar 3, 2024

CI is failing sometimes after this PR was merged

Looks like unmocked I/O somewhere

Thanks for reporting @bdraco, but unfortunately I won't have access to a computer in 24h, so I won't probably be able to fix it till then...

@Noltari
Copy link
Contributor Author

Noltari commented Mar 3, 2024

CI is failing sometimes after this PR was merged

Looks like unmocked I/O somewhere

Thanks for reporting @bdraco, but unfortunately I won't have access to a computer in 24h, so I won't probably be able to fix it till then...

I managed to do this from my phone:
#112102

@github-actions github-actions bot locked and limited conversation to collaborators Mar 4, 2024
@Noltari Noltari deleted the airzone-cloud-v0.4.5 branch March 4, 2024 15:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Airzone Cloud Error 429 Too many requests
5 participants