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 password for SkyFi devices #21

Merged
merged 6 commits into from
Aug 28, 2024
Merged

Fix password for SkyFi devices #21

merged 6 commits into from
Aug 28, 2024

Conversation

fredrike
Copy link
Owner

Fixes: #20

Related to: home-assistant/core#124095

@fredrike fredrike requested a review from icovada August 26, 2024 07:32
@fredrike
Copy link
Owner Author

@RonFac, can you test this version on your unit?

@fredrike fredrike self-assigned this Aug 26, 2024
@RonFac
Copy link

RonFac commented Aug 26, 2024

Happy to test. Need some guidance on how to go about it....

@RonFac
Copy link

RonFac commented Aug 26, 2024 via email

@cremor
Copy link
Collaborator

cremor commented Aug 26, 2024

@RonFac Was that link from one of the deleted comments in #20? If yes, delete that file! That is malware.

@RonFac
Copy link

RonFac commented Aug 26, 2024 via email

@fredrike
Copy link
Owner Author

fredrike commented Aug 26, 2024

@RonFac here is an example of upgrading pydaikin: home-assistant/core#123160 (comment)

This should be the right command:

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

@fredrike fredrike requested review from cremor and removed request for icovada August 26, 2024 14:21
@cremor
Copy link
Collaborator

cremor commented Aug 26, 2024

@fredrike Why did you request a review from me for this PR? I'm neither a Python developer (I can barely read/understand Python), nor do I own a SkyFi device.

@fredrike
Copy link
Owner Author

@fredrike Why did you request a review from me for this PR? I'm neither a Python developer (I can barely read/understand Python), nor do I own a SkyFi device.

Well, I need someone to read the code. You have been active in other parts so I figure you could help me out here. Sorry for the confusion.

@RonFac
Copy link

RonFac commented Aug 27, 2024 via email

Copy link
Collaborator

@kingy444 kingy444 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good to me from a pure code perspective

@fredrike
Copy link
Owner Author

I would love to be able to test. Unfortunately I don't know how to get to the right Linux environment - I am stuck inside the SSH-Core shell. When I try to execute "Login" at the SSH-core prompt, i do not know the password to proceed..... Ron

@kingy444 can you help @RonFac with a test-environment?

@fredrike
Copy link
Owner Author

I would love to be able to test. Unfortunately I don't know how to get to the right Linux environment - I am stuck inside the SSH-Core shell. When I try to execute "Login" at the SSH-core prompt, i do not know the password to proceed..... Ron

I wrote up a short description on how to debug in hassio: https://github.com/fredrike/pydaikin/wiki/Debugging-from-hassio

@RonFac
Copy link

RonFac commented Aug 28, 2024 via email

@fredrike fredrike force-pushed the master branch 3 times, most recently from 9509c7e to 7d0bebd Compare August 28, 2024 10:51
@fredrike
Copy link
Owner Author

Thanks Fredrike I managed to run your command and upgrade pydaikin to ver 2.13.4. Unfortunately no luck....
Here are the debug logs from this configuration:

2024-08-28 20:31:09.701 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi?pass={}', 'zones.cgi?pass={}']
2024-08-28 20:31:09.701 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi?pass={} {} [{}]
2024-08-28 20:31:09.705 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi?pass={} {} [{}]

Replying by email screws with formatting..

It doesn't look like you managed to run the new code. Perhaps you need to remove the daikin integration and then install it again.

@fredrike
Copy link
Owner Author

~ # docker exec -it homeassistant pip install @.***

You have missed some flags, it should be:

docker exec -it homeassistant pip install --force --no-deps git+https://github.com/fredrike/pydaikin.git@master

@RonFac
Copy link

RonFac commented Aug 28, 2024 via email

@fredrike
Copy link
Owner Author

Hm, I wonder what happens after you have installed the fixed pydaikin..

Did you remove and add your device?

@RonFac
Copy link

RonFac commented Aug 28, 2024 via email

@fredrike
Copy link
Owner Author

@RonFac please go here #21 and send the image again, what do you see in the logs?

@RonFac
Copy link

RonFac commented Aug 28, 2024

Here is the error screen:

image

These are the latest logs captured during my attempt to re-install the integration:

2024-08-28 21:13:22.698 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi', 'zones.cgi']
2024-08-28 21:13:22.699 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to ac.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:13:22.699 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
2024-08-28 21:13:22.701 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to zones.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:13:22.701 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
2024-08-28 21:20:04.979 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi', 'zones.cgi']
2024-08-28 21:20:04.980 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to ac.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:20:04.981 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
2024-08-28 21:20:04.985 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to zones.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:20:04.986 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
2024-08-28 21:20:05.007 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi', 'zones.cgi']
2024-08-28 21:20:05.008 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to ac.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:20:05.008 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
2024-08-28 21:20:05.011 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to zones.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:20:05.012 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
2024-08-28 21:20:05.066 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi', 'zones.cgi']
2024-08-28 21:20:05.067 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to ac.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:20:05.067 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
2024-08-28 21:20:05.071 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to zones.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:20:05.072 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
2024-08-28 21:24:46.212 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi', 'zones.cgi']
2024-08-28 21:24:46.213 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to ac.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:24:46.213 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi {'pass': '0'} [{}]
2024-08-28 21:24:46.218 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to zones.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:24:46.219 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi {'pass': '0'} [{}]
2024-08-28 21:24:51.360 DEBUG (MainThread) [pydaikin.factory] Trying connection to BRP069
2024-08-28 21:24:51.361 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['common/basic_info']
2024-08-28 21:24:51.362 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137/common/basic_info {} [{}]
2024-08-28 21:25:36.966 DEBUG (MainThread) [pydaikin.factory] Trying connection to BRP069
2024-08-28 21:25:36.966 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['common/basic_info']
2024-08-28 21:25:36.967 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137/common/basic_info {} [{}]
2024-08-28 21:25:51.669 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi', 'zones.cgi']
2024-08-28 21:25:51.670 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to ac.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:25:51.671 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
2024-08-28 21:25:51.674 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to zones.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:25:51.676 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
2024-08-28 21:25:51.690 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi', 'zones.cgi']
2024-08-28 21:25:51.690 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to ac.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:25:51.690 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
2024-08-28 21:25:51.692 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to zones.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:25:51.693 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
2024-08-28 21:34:12.944 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi', 'zones.cgi']
2024-08-28 21:34:12.945 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to ac.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:34:12.946 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
2024-08-28 21:34:12.949 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to zones.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:34:12.950 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
2024-08-28 21:34:13.002 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi', 'zones.cgi']
2024-08-28 21:34:13.003 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to ac.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:34:13.003 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
2024-08-28 21:34:13.005 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to zones.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:34:13.005 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]

@RonFac
Copy link

RonFac commented Aug 28, 2024

Maybe it's nothing, but I noticed this DEBUG log
"2024-08-28 21:24:51.360 DEBUG (MainThread) [pydaikin.factory] Trying connection to BRP069"
My device is not a BRP069 but a (SkyFi) BRP15A61

@fredrike
Copy link
Owner Author

Great! We are running the latest code.

2024-08-28 21:13:22.698 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi', 'zones.cgi']
2024-08-28 21:13:22.699 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to ac.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 21:13:22.701 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to zones.cgi with params: {'pass': 'HIDDEN'}

Now we just need to figure out why it's not working ;).

@RonFac
Copy link

RonFac commented Aug 28, 2024

Is the program trying to connect to a BRP069 ? SkyFi is BRP15A61. For all I know, BRP069 is not set up with a password,,,,,

@fredrike
Copy link
Owner Author

Is the program trying to connect to a BRP069 ? SkyFi is BRP15A61. For all I know, BRP069 is not set up with a password,,,,,

Yes that is strange. But it looks like you first tried with "correct" password, then 0 and finally without password.

I've updated the code so please try the pip install command again and report the logging back.

@RonFac
Copy link

RonFac commented Aug 28, 2024

Latest logging with new version:

2024-08-28 22:13:50.582 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi', 'zones.cgi']
2024-08-28 22:13:50.583 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to ac.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 22:13:50.584 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
2024-08-28 22:13:50.589 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to zones.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 22:13:50.590 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
2024-08-28 22:13:50.607 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi', 'zones.cgi']
2024-08-28 22:13:50.607 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to ac.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 22:13:50.608 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
2024-08-28 22:13:50.611 DEBUG (MainThread) [pydaikin.daikin_skyfi] Sending request to zones.cgi with params: {'pass': 'HIDDEN'}
2024-08-28 22:13:50.612 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]_

@fredrike
Copy link
Owner Author

Nope, that is not the latest code, please hookup here: https://community.home-assistant.io/u/fredrike

@RonFac
Copy link

RonFac commented Aug 28, 2024

I ran the same command as before: " docker exec -it homeassistant pip install --force --no-deps git+https://github.com/fredrike/pydaikin.git@skyfi-pass " Should that not have downloaded the latest pydaikin ?

@fredrike
Copy link
Owner Author

fredrike commented Aug 28, 2024

@RonFac new version available..

this might be faster to test:

docker exec -it homeassistant sh -c 'pip install --no-deps --force \
git+https://github.com/fredrike/pydaikin.git@skyfi-pass; \
pydaikin -a -p 17199 -vvvv 192.168.1.137'

That gives me this:

  Building wheel for pydaikin (pyproject.toml) ... done
  Created wheel for pydaikin: filename=pydaikin-2.13.4-py3-none-any.whl size=35285 sha256=7648ec63934963fa0b03d4d74a0f47be6a21a616de25034fd25eeeec47922949
  Stored in directory: /tmp/pip-ephem-wheel-cache-cgvgeh0f/wheels/66/6a/60/77a13ac629d89d1c07699df460d07614b5d2c406beb4325283
Successfully built pydaikin
Installing collected packages: pydaikin
  Attempting uninstall: pydaikin
    Found existing installation: pydaikin 2.13.4
    Uninstalling pydaikin-2.13.4:
      Successfully uninstalled pydaikin-2.13.4
Successfully installed pydaikin-2.13.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
DEBUG:pydaikin.daikin_base:Updating ['ac.cgi', 'zones.cgi']
DEBUG:pydaikin.daikin_skyfi:Sending request to http://192.168.1.137:2000ac.cgi with params: {'pass': 'HIDDEN'}
DEBUG:pydaikin.daikin_skyfi:Sending request to http://192.168.1.137:2000zones.cgi with params: {'pass': 'HIDDEN'}
WARNING:root:SkyFi Exception: Cannot connect to host 192.168.1.137:2000 ssl:default [Connect call failed ('192.168.1.137', 2000)]
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
WARNING:root:SkyFi Exception: Cannot connect to host 192.168.1.137:2000 ssl:default [Connect call failed ('192.168.1.137', 2000)]
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
DEBUG:pydaikin.daikin_base:Retrying pydaikin.daikin_base.Appliance._get_resource in 1.0 seconds as it raised ClientConnectorError: Cannot connect to host 192.168.1.137:2000 ssl:default [Connect call failed ('192.168.1.137', 2000)].
DEBUG:pydaikin.daikin_base:Retrying pydaikin.daikin_base.Appliance._get_resource in 1.0 seconds as it raised ClientConnectorError: Cannot connect to host 192.168.1.137:2000 ssl:default [Connect call failed ('192.168.1.137', 2000)].
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
DEBUG:pydaikin.daikin_base:Retrying pydaikin.daikin_base.Appliance._get_resource in 1.0 seconds as it raised ClientConnectorError: Cannot connect to host 192.168.1.137:2000 ssl:default [Connect call failed ('192.168.1.137', 2000)].
DEBUG:pydaikin.daikin_base:Retrying pydaikin.daikin_base.Appliance._get_resource in 1.0 seconds as it raised ClientConnectorError: Cannot connect to host 192.168.1.137:2000 ssl:default [Connect call failed ('192.168.1.137', 2000)].
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
ERROR:pydaikin.daikin_base:Exception in TaskGroup: Cannot connect to host 192.168.1.137:2000 ssl:default [Connect call failed ('192.168.1.137', 2000)]
ERROR:pydaikin.daikin_base:Exception in TaskGroup: Cannot connect to host 192.168.1.137:2000 ssl:default [Connect call failed ('192.168.1.137', 2000)]
Exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1073, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 104, in start_connection
    raise first_exception
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 81, in start_connection
    sock = await _connect_sock(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 166, in _connect_sock
    await loop.sock_connect(sock, address)
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.1.137', 2000)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/pydaikin", line 163, in <module>
    run(main())
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/local/bin/pydaikin", line 139, in main
    daikin = await DaikinFactory(args.device, key=args.key, password=args.password)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pydaikin/factory.py", line 26, in __new__
    await instance.__init__(*a, **kw)
  File "/usr/local/lib/python3.12/site-packages/pydaikin/factory.py", line 65, in __init__
    await self._generated_object.init()
  File "/usr/local/lib/python3.12/site-packages/pydaikin/daikin_skyfi.py", line 69, in init
    await self.update_status(self.HTTP_RESOURCES)
  File "/usr/local/lib/python3.12/site-packages/pydaikin/daikin_base.py", line 197, in update_status
    self.values.update_by_resource(resource, task.result())
                                             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pydaikin/daikin_skyfi.py", line 137, in _get_resource
    return await super()._get_resource(path, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 189, in async_wrapped
    return await copy(fn, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 111, in __call__
    do = await self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
    result = await action(retry_state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/_utils.py", line 99, in inner
    return call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 418, in exc_check
    raise retry_exc.reraise()
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 185, in reraise
    raise self.last_attempt.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 114, in __call__
    result = await fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pydaikin/daikin_base.py", line 155, in _get_resource
    async with self.session.get(
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1353, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 657, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 564, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 975, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1350, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1319, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1088, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.137:2000 ssl:default [Connect call failed ('192.168.1.137', 2000)]
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fd6db690380>

@RonFac
Copy link

RonFac commented Aug 28, 2024

This is what I got on the terminal screen:

docker exec -it homeassistant sh -c 'pip install --no-deps --force \

git+https://github.com/fredrike/pydaikin.git@skyfi-pass;
pydaikin -a -p 17199 -vvvv 192.168.1.137'
Looking in indexes: https://pypi.org/simple, https://wheels.home-assistant.io/musllinux-index/
Collecting git+https://github.com/fredrike/pydaikin.git@skyfi-pass
Cloning https://github.com/fredrike/pydaikin.git (to revision skyfi-pass) to /tmp/pip-req-build-c6c79lfa
Running command git clone --filter=blob:none --quiet https://github.com/fredrike/pydaikin.git /tmp/pip-req-build-c6c79lfa
Running command git checkout -b skyfi-pass --track origin/skyfi-pass
branch 'skyfi-pass' set up to track 'origin/skyfi-pass'.
Switched to a new branch 'skyfi-pass'
Resolved https://github.com/fredrike/pydaikin.git to commit 171d208
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pydaikin
Building wheel for pydaikin (pyproject.toml) ... done
Created wheel for pydaikin: filename=pydaikin-2.13.4-py3-none-any.whl size=35285 sha256=da8be5f41d1e3e729bdc8e3aa7ab484c9237663325730168e42f195c3d6beb73
Stored in directory: /tmp/pip-ephem-wheel-cache-h2qz7sgs/wheels/66/6a/60/77a13ac629d89d1c07699df460d07614b5d2c406beb4325283
Successfully built pydaikin
Installing collected packages: pydaikin
Attempting uninstall: pydaikin
Found existing installation: pydaikin 2.13.4
Uninstalling pydaikin-2.13.4:
Successfully uninstalled pydaikin-2.13.4
Successfully installed pydaikin-2.13.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
DEBUG:pydaikin.daikin_base:Updating ['ac.cgi', 'zones.cgi']
DEBUG:pydaikin.daikin_skyfi:Sending request to http://192.168.1.137:2000ac.cgi with params: {'pass': 'HIDDEN'}
DEBUG:pydaikin.daikin_skyfi:Sending request to http://192.168.1.137:2000zones.cgi with params: {'pass': 'HIDDEN'}
WARNING:root:SkyFi Exception: [Errno 104] Connection reset by peer
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
DEBUG:pydaikin.daikin_base:Retrying pydaikin.daikin_base.Appliance._get_resource in 1.0 seconds as it raised ClientOSError: [Errno 104] Connection reset by peer.
DEBUG:root:SkyFi: status: 200, text: nz=3&zone1=Living&zone2=Bedrooms&zone3=Rumpus
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
DEBUG:pydaikin.daikin_base:Retrying pydaikin.daikin_base.Appliance._get_resource in 1.0 seconds as it raised ClientOSError: [Errno 104] Connection reset by peer.
DEBUG:pydaikin.daikin_skyfi:Parsing nz=3&zone1=Living&zone2=Bedrooms&zone3=Rumpus
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
DEBUG:pydaikin.daikin_skyfi:Parsing opmode=0&units=.&settemp=20.0&fanspeed=2&fanflags=3&acmode=8&tonact=0&toffact=0&prog=0&time=23:34&day=2&roomtemp=20&outsidetemp=19&louvre=0&zone=224&flt=0&test=0&errcode=&sensors=1
DEBUG:pydaikin.factory:Daikin generated object: <pydaikin.daikin_skyfi.DaikinSkyFi object at 0x7f9413fce0>
mode: off
day: 2
errcode:
f_rate: medium/auto
fanflags: 3
f_rate: medium/auto
flt: 0
htemp: 20
louvre: 0
mode: off
nz: 3
pow: 0
otemp: 19
otemp: 19
pow: 0
prog: 0
htemp: 20
sensors: 1
stemp: 20.0
stemp: 20.0
test: 0
time: 23:34
toffact: 0
tonact: 0
units: .
zone: 111
zone1: Living
zone2: Bedrooms
zone3: Rumpus
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f9413fe00>
~ #
The integration still does not work, and the DEBUG logs are the same as before:
2024-08-28 23:26:45.834 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi?pass={}', 'zones.cgi?pass={}']
2024-08-28 23:26:45.835 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/ac.cgi?pass={} {} [{}]
2024-08-28 23:26:45.838 DEBUG (MainThread) [pydaikin.daikin_base] Calling: http://192.168.1.137:2000/zones.cgi?pass={} {} [{}]

I will sign off now - It's late in Sydney. Thanks for your time...
Ron

@fredrike
Copy link
Owner Author

This is what I got on the terminal screen:

docker exec -it homeassistant sh -c 'pip install --no-deps --force \

git+https://github.com/fredrike/pydaikin.git@skyfi-pass; 
pydaikin -a -p 17199 -vvvv 192.168.1.137'
Looking in indexes: https://pypi.org/simple, https://wheels.home-assistant.io/musllinux-index/
Collecting git+https://github.com/fredrike/pydaikin.git@skyfi-pass
Cloning https://github.com/fredrike/pydaikin.git (to revision skyfi-pass) to /tmp/pip-req-build-c6c79lfa
Running command git clone --filter=blob:none --quiet https://github.com/fredrike/pydaikin.git /tmp/pip-req-build-c6c79lfa
Running command git checkout -b skyfi-pass --track origin/skyfi-pass
branch 'skyfi-pass' set up to track 'origin/skyfi-pass'.
Switched to a new branch 'skyfi-pass'
Resolved https://github.com/fredrike/pydaikin.git to commit [171d208](https://github.com/fredrike/pydaikin/commit/171d2081fb365637c05462fe6cb4909579a7cc30)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pydaikin
Building wheel for pydaikin (pyproject.toml) ... done
Created wheel for pydaikin: filename=pydaikin-2.13.4-py3-none-any.whl size=35285 sha256=da8be5f41d1e3e729bdc8e3aa7ab484c9237663325730168e42f195c3d6beb73
Stored in directory: /tmp/pip-ephem-wheel-cache-h2qz7sgs/wheels/66/6a/60/77a13ac629d89d1c07699df460d07614b5d2c406beb4325283
Successfully built pydaikin
Installing collected packages: pydaikin
Attempting uninstall: pydaikin
Found existing installation: pydaikin 2.13.4
Uninstalling pydaikin-2.13.4:
Successfully uninstalled pydaikin-2.13.4
Successfully installed pydaikin-2.13.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
DEBUG:pydaikin.daikin_base:Updating ['ac.cgi', 'zones.cgi']
DEBUG:pydaikin.daikin_skyfi:Sending request to http://192.168.1.137:2000ac.cgi with params: {'pass': 'HIDDEN'}
DEBUG:pydaikin.daikin_skyfi:Sending request to http://192.168.1.137:2000zones.cgi with params: {'pass': 'HIDDEN'}
WARNING:root:SkyFi Exception: [Errno 104] Connection reset by peer
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
DEBUG:pydaikin.daikin_base:Retrying pydaikin.daikin_base.Appliance._get_resource in 1.0 seconds as it raised ClientOSError: [Errno 104] Connection reset by peer.
DEBUG:root:SkyFi: status: 200, text: nz=3&zone1=Living&zone2=Bedrooms&zone3=Rumpus
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/zones.cgi {'pass': '17199'} [{}]
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
DEBUG:pydaikin.daikin_base:Retrying pydaikin.daikin_base.Appliance._get_resource in 1.0 seconds as it raised ClientOSError: [Errno 104] Connection reset by peer.
DEBUG:pydaikin.daikin_skyfi:Parsing nz=3&zone1=Living&zone2=Bedrooms&zone3=Rumpus
DEBUG:pydaikin.daikin_base:Calling: http://192.168.1.137:2000/ac.cgi {'pass': '17199'} [{}]
DEBUG:pydaikin.daikin_skyfi:Parsing opmode=0&units=.&settemp=20.0&fanspeed=2&fanflags=3&acmode=8&tonact=0&toffact=0&prog=0&time=23:34&day=2&roomtemp=20&outsidetemp=19&louvre=0&zone=224&flt=0&test=0&errcode=&sensors=1
DEBUG:pydaikin.factory:Daikin generated object: <pydaikin.daikin_skyfi.DaikinSkyFi object at 0x7f9413fce0>
mode: off
day: 2
errcode:
f_rate: medium/auto
fanflags: 3
f_rate: medium/auto
flt: 0
htemp: 20
louvre: 0
mode: off
nz: 3
pow: 0
otemp: 19
otemp: 19
pow: 0
prog: 0
htemp: 20
sensors: 1
stemp: 20.0
stemp: 20.0
test: 0
time: 23:34
toffact: 0
tonact: 0
units: .
zone: 111
zone1: Living
zone2: Bedrooms
zone3: Rumpus
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f9413fe00>
~ #

I will sign off now - It's late in Sydney. Thanks for your time... Ron

Wow, that's great! It seems like it is working now. All it took was a little more exception-handling and retries.

The integration still does not work, and the DEBUG logs are the same as before:

2024-08-28 23:26:45.834 DEBUG (MainThread) [pydaikin.daikin_base] Updating ['ac.cgi?pass={}', 'zones.cgi?pass={}']
2024-08-28 23:26:45.835 DEBUG (MainThread) [pydaikin.daikin_base] Calling: [http://192.168.1.137:2000/ac.cgi?pass={}](http://192.168.1.137:2000/ac.cgi?pass=%7B%7D) {} [{}]
2024-08-28 23:26:45.838 DEBUG (MainThread) [pydaikin.daikin_base] Calling: [http://192.168.1.137:2000/zones.cgi?pass={}](http://192.168.1.137:2000/zones.cgi?pass=%7B%7D) {} [{}]

That's strange, but it looks like you are running the old version again (['ac.cgi?pass={}', 'zones.cgi?pass={}'] is old).

I'll merge this and create a new version for HomeAssistant.

@fredrike fredrike merged commit 8d0c508 into master Aug 28, 2024
9 checks passed
@fredrike fredrike added the SkyFi Devices using the SkyFi class label Aug 28, 2024
@ciaran4
Copy link

ciaran4 commented Aug 28, 2024

I have followed the above and it works and initlises however when I try and use any function in HA under entities it shows an error (attached) have tried restarting home assist and uninstalling and re installing via script

Uploading Screenshot_29-8-2024_83824_192.168.1.38.jpeg…

Failed to perform the action switch/turn_on. Unexpected HTTP status code 500 for http://192.168.1.209:2000/set.cgi?p=0&t=20.0&f=3&m=8&pass=72102

@fredrike
Copy link
Owner Author

@ciaran4thank you for finding this. I guess there were a reason why we did retries even for clien response errors. I'll see what I can do to fix it.

The error I'd due to the bad quality of the skyfi module.

@kingy444
Copy link
Collaborator

kingy444 commented Aug 29, 2024

@ciaran4thank you for finding this. I guess there were a reason why we did retries even for clien response errors. I'll see what I can do to fix it.

The error I'd due to the bad quality of the skyfi module.

@fredrike haven't had any time to help out with these issues of late but if retry is all we are after the tenacity module should be able to handle that with its @retry decorator

@RonFac
Copy link

RonFac commented Aug 29, 2024 via email

@fredrike
Copy link
Owner Author

fredrike commented Aug 29, 2024

Get Outlook for Androidhttps://aka.ms/AAb9ysg

I rather not, I have an iPhone..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SkyFi Devices using the SkyFi class
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Skyfi password is not passed anymore
5 participants