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

patch to survive the latest HA changes #61

Merged
merged 11 commits into from
Jan 23, 2025

Conversation

leonardpitzu
Copy link

just updating some parts of the code to adapt to latest HA changes (I am not into HA development but it should work)

@mharizanov
Copy link

@leonardpitzu Thank you for this! @epoplavskis @jvitkauskas

@leonardpitzu
Copy link
Author

hope they do not merge it completely as I have changed some stuff for my own purpose (like maintainer) :)

@leonardpitzu leonardpitzu reopened this Aug 5, 2024
@mharizanov
Copy link

@leonardpitzu I get the following error with your branch when attempting to change the fan speed:

AttributeError: type object 'HVACMode' has no attribute 'FAN_OFF'. Did you mean: 'FAN_ONLY'?

The issue seems to be with line :

https://github.com/leonardpitzu/homeassistant_salus/blob/7985d188cdefcff34610e3f28a2c937cdb4d0a7b/custom_components/salus/climate.py#L214

Detailed:

2024-08-14 12:56:04.018 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547719297584] Unexpected exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2763, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2806, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 742, in async_handle_set_fan_mode_service
await self.async_set_fan_mode(fan_mode)
File "/config/custom_components/salus/climate.py", line 214, in async_set_fan_mode
if fan_mode == HVACMode.FAN_OFF:
^^^^^^^^^^^^^^^^
AttributeError: type object 'HVACMode' has no attribute 'FAN_OFF'. Did you mean: 'FAN_ONLY'?

@leonardpitzu
Copy link
Author

oops, my bad. fixing it right away.

@leonardpitzu
Copy link
Author

Try my branch and see how it works. In case of positive feedback I'll push the changes.

@mharizanov
Copy link

mharizanov commented Aug 14, 2024

The original error is gone, now another one pops up, I trust in the underlying librаry:

2024-08-14 14:28:43.315 ERROR (MainThread) [pyit600] write failed: {'requestAttr': 'write', 'id': [{'data': {'DeviceType': 100, 'Endpoint': 9, 'UniID': 'zzzzzzzzzzzzzzcensoredzzzzzzzzz'}, 'sFanS': {'FanMode': 5}}]}
2024-08-14 14:28:43.318 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547308299616] Unexpected exception
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/pyit600/gateway.py", line 940, in _make_encrypted_request
raise IT600CommandError(
pyit600.exceptions.IT600CommandError: iT600 gateway rejected 'write' command with content '{'requestAttr': 'write', 'id': [{'data': {'DeviceType': 100, 'Endpoint': 9, 'UniID': 'zzzzzzzzzzzzzzcensoredzzzzzzzzz'}, 'sFanS': {'FanMode': 5}}]}'

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

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2763, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2806, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 742, in async_handle_set_fan_mode_service
await self.async_set_fan_mode(fan_mode)
File "/config/custom_components/salus/climate.py", line 229, in async_set_fan_mode
await self._gateway.set_climate_device_fan_mode(self._idx, mode)
File "/usr/local/lib/python3.12/site-packages/pyit600/gateway.py", line 809, in set_climate_device_fan_mode
await self._make_encrypted_request(
File "/usr/local/lib/python3.12/site-packages/pyit600/gateway.py", line 957, in _make_encrypted_request
raise IT600CommandError(
pyit600.exceptions.IT600CommandError: Unknown error occurred while communicating with iT600 gateway

@leonardpitzu
Copy link
Author

have no idea what this is and I have no fan to test...
is this the debug log?

@mharizanov
Copy link

Yes, debug log extract. I can probably live without fan speed control :) Anyway, your main fix to this seemingly abandoned repo is appreciated - thanks

@leonardpitzu
Copy link
Author

did you reboot in between or remove and re-add the integration?

@leonardpitzu
Copy link
Author

I could fix the library I guess but it's way more complex and honestly speaking its a lot of work and I have few time to spare right not. Forking the library and linking the integration to the new lib means assuming some activities I cannot do right now. Just as a FYI - I would change the lib quite a bit ;)

@mharizanov
Copy link

did you reboot in between or remove and re-add the integration?

Removed the original repo from HACS
Added your repo in HACS
Updated it after you fixed the issue, this required a reatart

@leonardpitzu
Copy link
Author

can you redownload and paste the logs? I just want to see what fan mode actually looks like

@mharizanov
Copy link

`2024-08-15 08:58:19.478 INFO (MainThread) [custom_components.salus.climate] set_fan_mode: Auto
2024-08-15 08:58:19.493 ERROR (MainThread) [pyit600] write failed: {'requestAttr': 'write', 'id': [{'data': {'DeviceType': 100, 'Endpoint': 9, 'UniID': '001e5e090904a66e'}, 'sFanS': {'FanMode': 5}}]}
2024-08-15 08:58:19.495 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [546750278832] Unexpected exception
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/pyit600/gateway.py", line 940, in _make_encrypted_request
raise IT600CommandError(
pyit600.exceptions.IT600CommandError: iT600 gateway rejected 'write' command with content '{'requestAttr': 'write', 'id': [{'data': {'DeviceType': 100, 'Endpoint': 9, 'UniID': '001e5e090904a66e'}, 'sFanS': {'FanMode': 5}}]}'

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

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2763, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2806, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 742, in async_handle_set_fan_mode_service
await self.async_set_fan_mode(fan_mode)
File "/config/custom_components/salus/climate.py", line 230, in async_set_fan_mode
await self._gateway.set_climate_device_fan_mode(self._idx, mode)
File "/usr/local/lib/python3.12/site-packages/pyit600/gateway.py", line 809, in set_climate_device_fan_mode
await self._make_encrypted_request(
File "/usr/local/lib/python3.12/site-packages/pyit600/gateway.py", line 957, in _make_encrypted_request
raise IT600CommandError(
pyit600.exceptions.IT600CommandError: Unknown error occurred while communicating with iT600 gateway`

@mharizanov
Copy link

mharizanov commented Aug 15, 2024

It seems to be the string, e.g. FAN_AUTO = 'Auto'

2024-08-15 08:58:15.652 INFO (MainThread) [custom_components.salus.climate] set_fan_mode: Medium
2024-08-15 08:57:46.414 INFO (MainThread) [custom_components.salus.climate] set_fan_mode: High
2024-08-15 08:58:19.478 INFO (MainThread) [custom_components.salus.climate] set_fan_mode: Auto

@homefuzz-oz
Copy link

I just tested this on my setup and it works perfectly. @jvitkauskas, are you able to merge this please?

@212850a
Copy link

212850a commented Dec 19, 2024

Works fine for me either in 2024.12.3, all warning messages have gone.

@IonutGrigorut
Copy link

hi ... after updating to core 2025.1.1 salus gateway doesn't work anymore. @leonardpitzu can you please help me ? Because am a complete newbie to HA

@Rasmus-Fink
Copy link

Same situation as IonutGrigorut
I have no idea how to test this branch. I you can give me som guidelines on how to do that I'd be happy to help out verifying that it works on 2025.1.1.
I know my way around git - but no experience with HA on the dev side of things...

//Fink

@Nick-OFF
Copy link

Nick-OFF commented Jan 11, 2025 via email

@Rasmus-Fink
Copy link

Thanks for the pointer!
I cloned the source repo (https://github.com/leonardpitzu/homeassistant_salus.git) and using a SAMBA share copied all the files to the HA instance. After reboot it's working again.

  • So yet another successful test of the PR...

//Fink

@epoplavskis epoplavskis merged commit e2c20a8 into epoplavskis:master Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants