home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.82k stars 30.51k forks source link

KNX: heat_cool_state_address ignored after update to xknx 3.0.0 in HA 2024.8.1 #123733

Closed ufozone closed 2 months ago

ufozone commented 2 months ago

The problem

Description

After updating to Home Assistant version 2024.8.1, which includes an update of the xknx library to version 3.0.0 (#122891), the heat_cool_state_address parameter in the KNX integration is no longer processed correctly. This results in the mode (heating/cooling) not being updated in the Home Assistant state and frontend.

Expected Behavior

The heat_cool_state_address parameter should display the current mode (heating or cooling) as it did in previous versions (up to 2024.7.4): Screenshot 2024-08-12 192529

The state of the entity is "cooling".

Actual Behavior

Although the configuration remains unchanged and KNX messages are sent and received correctly, the mode is not reflected in Home Assistant. The heat_cool_state_address parameter appears to be ignored: Screenshot 2024-08-12 192851

The state of the entity is "heating".

What version of Home Assistant Core has the issue?

core-2024.8.1

What was the last working version of Home Assistant Core?

core-2024.7.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

knx

Link to integration documentation on our website

https://www.home-assistant.io/integrations/knx/

Diagnostics information

home-assistant_knx_2024-08-12T18-25-42.650Z.log

Example YAML snippet

knx:
  climate:
    - name: flur_eg_windfang
      temperature_address: "12/6/0"
      target_temperature_address: "12/4/2"
      target_temperature_state_address: "12/4/2"
      command_value_state_address: "12/4/10"
      operation_mode_address: "12/4/1"
      operation_mode_state_address: "12/4/11"
      heat_cool_state_address: "0/4/20" # global address for all rooms
      min_temp: 15.0
      max_temp: 25.0

Anything in the logs that might be useful for us?

Logs do not show any significant difference between the working versions (up to 2024.7.4) and the non-working version (2024.8.1).

core-2024.6.4 and core-2024.7.4:

2024-08-12 17:23:17.680 INFO (MainThread) [xknx.log] XKNX v2.12.2 starting tunneling connection to KNX bus.
2024-08-12 17:23:17.818 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueOperationMode device_name="flur_eg_windfang Mode" feature_name="Operation mode" <12/4/1, 12/4/11, [], None /> />
2024-08-12 17:23:17.819 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueBinaryHeatCool device_name="flur_eg_windfang Mode" feature_name="Heat/Cool" <None, 0/4/20, [], None /> />
2024-08-12 17:23:17.819 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueTemp device_name="flur_eg_windfang" feature_name="Current temperature" <None, 12/6/0, [], None /> />
2024-08-12 17:23:17.820 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueTemp device_name="flur_eg_windfang" feature_name="Target temperature" <12/4/2, 12/4/2, [], None /> />
2024-08-12 17:23:17.821 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueScaling device_name="flur_eg_windfang" feature_name="Command value" <None, 12/4/10, [], None /> />
2024-08-12 17:23:17.822 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueOperationMode device_name="gastebad Mode" feature_name="Operation mode" <13/4/1, 13/4/11, [], None /> />
2024-08-12 17:23:17.823 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueTemp device_name="gastebad" feature_name="Current temperature" <None, 13/6/0, [], None /> />
2024-08-12 17:23:17.823 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueTemp device_name="gastebad" feature_name="Target temperature" <13/4/2, 13/4/2, [], None /> />
2024-08-12 17:23:17.823 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueScaling device_name="gastebad" feature_name="Command value" <None, 13/4/10, [], None /> />
2024-08-12 17:23:17.839 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 12/4/11 for flur_eg_windfang Mode - Operation mode
2024-08-12 17:23:17.840 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 0/4/20 for flur_eg_windfang Mode - Heat/Cool
2024-08-12 17:23:17.910 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 12/6/0 for flur_eg_windfang - Current temperature
2024-08-12 17:23:17.977 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 12/4/2 for flur_eg_windfang - Target temperature
2024-08-12 17:23:18.020 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 12/4/10 for flur_eg_windfang - Command value
2024-08-12 17:23:18.067 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 13/4/11 for gastebad Mode - Operation mode
2024-08-12 17:23:18.121 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 13/6/0 for gastebad - Current temperature
2024-08-12 17:23:18.177 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 13/4/2 for gastebad - Target temperature
2024-08-12 17:23:18.245 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 13/4/10 for gastebad - Command value

core-2024.8.1:

2024-08-12 17:28:32.783 INFO (MainThread) [xknx.log] XKNX v3.0.0 starting tunneling connection to KNX bus.
2024-08-12 17:28:33.354 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueTemp device_name="flur_eg_windfang" feature_name="Current temperature" <None, 12/6/0, [], None /> />
2024-08-12 17:28:33.354 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueTemp device_name="flur_eg_windfang" feature_name="Target temperature" <12/4/2, 12/4/2, [], None /> />
2024-08-12 17:28:33.355 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueScaling device_name="flur_eg_windfang" feature_name="Command value" <None, 12/4/10, [], None /> />
2024-08-12 17:28:33.355 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueOperationMode device_name="flur_eg_windfang Mode" feature_name="Operation mode" <12/4/1, 12/4/11, [], None /> />
2024-08-12 17:28:33.355 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueBinaryHeatCool device_name="flur_eg_windfang Mode" feature_name="Heat/Cool" <None, 0/4/20, [], None /> />
2024-08-12 17:28:33.357 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueTemp device_name="gastebad" feature_name="Current temperature" <None, 13/6/0, [], None /> />
2024-08-12 17:28:33.357 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueTemp device_name="gastebad" feature_name="Target temperature" <13/4/2, 13/4/2, [], None /> />
2024-08-12 17:28:33.357 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueScaling device_name="gastebad" feature_name="Command value" <None, 13/4/10, [], None /> />
2024-08-12 17:28:33.357 DEBUG (MainThread) [xknx.state_updater] StateUpdater registered StateTrackerType.EXPIRE 60 for <RemoteValueOperationMode device_name="gastebad Mode" feature_name="Operation mode" <13/4/1, 13/4/11, [], None /> />
2024-08-12 17:28:33.386 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 12/6/0 for flur_eg_windfang - Current temperature
2024-08-12 17:28:33.386 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 12/4/2 for flur_eg_windfang - Target temperature
2024-08-12 17:28:33.505 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 12/4/10 for flur_eg_windfang - Command value
2024-08-12 17:28:33.559 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 12/4/11 for flur_eg_windfang Mode - Operation mode
2024-08-12 17:28:33.619 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 0/4/20 for flur_eg_windfang Mode - Heat/Cool
2024-08-12 17:28:33.653 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 13/6/0 for gastebad - Current temperature
2024-08-12 17:28:33.697 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 13/4/2 for gastebad - Target temperature
2024-08-12 17:28:33.741 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 13/4/10 for gastebad - Command value
2024-08-12 17:28:33.786 DEBUG (MainThread) [xknx.state_updater] StateUpdater reading 13/4/11 for gastebad Mode - Operation mode

Additional information

Troubleshooting Attempts

  1. Replaced heat_cool_state_address with heat_cool_address: Result: The heating/cooling state is displayed correctly, but the select field in the frontend allows writing to the 0/4/20 address, which is (in my case) definitely not desired.

  2. Added heat_cool_address with a dummy address 0/4/250 in the configuration: Result: The display in the frontend is correct, but the select field allows writing to the dummy address, causing the display in the frontend to change, which is also not desired.

  3. Added the controller_modes parameter with an empty list []: Result: The values of heat_cool_address and heat_cool_state_address are ignored completely.

home-assistant[bot] commented 2 months ago

Hey there @julius2342, @farmio, @marvin-w, mind taking a look at this issue as it has been labeled with an integration (knx) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `knx` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign knx` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


knx documentation knx source (message by IssueLinks)

ufozone commented 2 months ago

Diagnostics information

home-assistant_knx_2024-08-12T18-25-42.650Z.log

farmio commented 2 months ago

Hi 👋! Thanks for filing this issue. You seem to have found the correct workaround already:

  1. Added heat_cool_address with a dummy address 0/4/250 in the configuration: Result: The display in the frontend is correct, but the select field allows writing to the dummy address, causing the display in the frontend to change, which is also not desired.

Afair this provides the exact same behaviour as 2024.7.

I'll have a look if read-only modes can be supported correctly in a future release.

ufozone commented 2 months ago

Hey @farmio,

Thank you very much for this super quick answer!!!

The workaround is not really good, I think, as it does not provide exactly the same behavior as 2024.7. Specifying the heat_cool_address now allows a change to the mode because the integration thinks it has written to the correct address.

I don't understand why the behavior has changed. Previously, the entity also supported the read-only mode by specifying only the heat_cool_state_address.

I looked at the code diff from pull request #122891 and could not find any indication of a deliberate change in behavior in the integration.

The 352 changed files between xknx 2.12.2 and 3.0.0 seem to me like searching for a needle in a haystack. ;-)

farmio commented 2 months ago

It's here https://github.com/XKNX/xknx/pull/1500/files#diff-c47ab9c3e342f3010e88247d04e21b9186dade8ac40b46a7fdd3491757d14854 xknx/devices/climate_mode.py Line 162

I don't think there was ever a distinction between only state and write+state address. At least I didn't see where from a first look.

ufozone commented 2 months ago

Unfortunately, I don't fully understand the code, but could it be that in 2.12.2 self._iter_controller_remote_values() produced self.remote_value_heat_cool, and thus "Cool" was appended to self._controller_modes? I can't see any reason why "Cool" is no longer available in self._controller_modes if only heat_cool_state_address is set at the entry.

The way it worked before was perfect. Certainly not just for me: heating/cooling mode is set by the climate control system and I just want to record and visualize this state. Under no circumstances should this KNX address be written via HA. Until core-2024.7.4, the behavior worked just the same way by setting only the heat_cool_state_address without heat_cool_address.

ufozone commented 2 months ago

Thank you very much @farmio ❤️