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

Fix BRP072C devices not working #13

Merged
merged 3 commits into from
Aug 10, 2024
Merged

Conversation

mattyway
Copy link
Contributor

  • Fixes headers and ssl_context fields not being passed when making requests for a BRP072C device
  • Seems like they were missed when refactoring code in this commit
  • Fixes Daikin devices failing in Home Assistant 2024.8 with the ssl:default [[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:1000)] error

@fredrike
Copy link
Owner

Thanks!

I'll merge and release a new package in a while.

@fredrike fredrike merged commit dc6aedb into fredrike:master Aug 10, 2024
3 checks passed
@fredrike
Copy link
Owner

New version published here: https://pypi.org/project/pydaikin/2.13.2/

@fredrike
Copy link
Owner

  • Fixes headers and ssl_context fields not being passed when making requests for a BRP072C device
  • Seems like they were missed when refactoring code in this commit
  • Fixes Daikin devices failing in Home Assistant 2024.8 with the ssl:default [[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:1000)] error

Nice find, I think I did have a thought of this when reviewed the refactoring but it eventually slipped.

@cremor
Copy link
Collaborator

cremor commented Aug 10, 2024

@mattyway @fredrike Looks like this change broke non-BRP072C devices: home-assistant/core#123550

@totolook
Copy link

@mattyway Seem broke on my DaikinBRP069

Error log on HA:

2024-08-10 22:34:29.099 DEBUG (MainThread) [pydaikin.factory] Trying connection to BRP069
2024-08-10 22:34:29.099 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['common/basic_info']
2024-08-10 22:34:29.100 ERROR (MainThread) [pydaikin.daikin_base] Exception in TaskGroup: 'DaikinBRP069' object has no attribute 'headers'

The stack trace from library:

(.venv) antonio in ~/py-test λ pydaikin -a  10.10.10.2
Exception in TaskGroup: 'DaikinBRP069' object has no attribute 'headers'
Traceback (most recent call last):
  File "/home/antonio/py-test/.venv/bin/pydaikin", line 163, in <module>
    run(main())
  File "/home/linuxbrew/.linuxbrew/opt/python@3.12/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/home/linuxbrew/.linuxbrew/opt/python@3.12/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/linuxbrew/.linuxbrew/opt/python@3.12/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/antonio/py-test/.venv/bin/pydaikin", line 139, in main
    daikin = await DaikinFactory(args.device, key=args.key, password=args.password)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/antonio/py-test/.venv/lib/python3.12/site-packages/pydaikin/factory.py", line 26, in __new__
    await instance.__init__(*a, **kw)
  File "/home/antonio/py-test/.venv/lib/python3.12/site-packages/pydaikin/factory.py", line 52, in __init__
    await self._generated_object.update_status(
  File "/home/antonio/py-test/.venv/lib/python3.12/site-packages/pydaikin/daikin_base.py", line 189, in update_status
    self.values.update_by_resource(resource, task.result())
                                             ^^^^^^^^^^^^^
  File "/home/antonio/py-test/.venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 189, in async_wrapped
    return await copy(fn, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/antonio/py-test/.venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 111, in __call__
    do = await self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/antonio/py-test/.venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
    result = await action(retry_state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/antonio/py-test/.venv/lib/python3.12/site-packages/tenacity/_utils.py", line 99, in inner
    return call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/antonio/py-test/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/home/linuxbrew/.linuxbrew/opt/python@3.12/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/linuxbrew/.linuxbrew/opt/python@3.12/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/antonio/py-test/.venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 114, in __call__
    result = await fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/antonio/py-test/.venv/lib/python3.12/site-packages/pydaikin/daikin_base.py", line 138, in _get_resource
    headers = self.headers
              ^^^^^^^^^^^^
AttributeError: 'DaikinBRP069' object has no attribute 'headers'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7ff3e15d8710>

@fredrike
Copy link
Owner

@mattyway you showed a way to install a custom version of pydaikin, can you assist @RonFac in doing the same in this: #21

I guess this is the command but I don't know how to run that in hass-os:

pip install git+https://github.com/fredrike/pydaikin.git@skyfi-pass

@fredrike fredrike added the BRP072C Devices with the BRP072C - module label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BRP072C Devices with the BRP072C - module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants