Skip to content

Allow configuring KNX preset_modes via the operation_modes variable #33068

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

Merged
merged 1 commit into from
Apr 18, 2020
Merged

Allow configuring KNX preset_modes via the operation_modes variable #33068

merged 1 commit into from
Apr 18, 2020

Conversation

FredericMa
Copy link
Contributor

@FredericMa FredericMa commented Mar 20, 2020

Proposed change

XKNX accepts both hvac_modes and preset_modes but the integration only allows hvac_modes to be set. This PR fixes that by also allowing preset_modes. This is only an issue if you override the default supported operation modes.

Docs PR:

home-assistant/home-assistant.io#13042

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)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml
climate:
  - platform: knx
    name: bedroom_front
    temperature_address: '4/0/0'
    target_temperature_address: '1/0/0'
    target_temperature_state_address: '4/1/0'
    operation_mode_address: '1/1/0'
    operation_mode_state_address: '4/2/0'
    min_temp: 7.0
    max_temp: 28.0
    operation_modes: ['Heat', 'Comfort', 'Frost Protection']

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
  • The code has been formatted using Black (black --fast 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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@probot-home-assistant
Copy link

Hey there @Julius2342, mind taking a look at this pull request as its been labeled with a integration (knx) you are listed as a codeowner for? Thanks!

@MartinHjelmare MartinHjelmare changed the title KNX - Allow preset_modes to be configured via the operation_modes variable. Allow configuring KNX preset_modes via the operation_modes variable Mar 20, 2020
@elupus
Copy link
Contributor

elupus commented Mar 21, 2020

This does look a bit weird, but maybe it's right. Note presets!=mode in HA. You set the separately. But here they seem combined?

@FredericMa
Copy link
Contributor Author

I agree with you that this might cause confusion and is rather counterintuitive compared to HA. It might be better to split them in 2 variables.
I'll create an issue at XKNX to address ad discus this.
To clarify this PR; the climate_modes variable is parsed over here:
https://github.com/XKNX/xknx/blob/9790cdb696285b5700ec06c571193a7feeb96a39/xknx/devices/climate_mode.py#L72-L76
and validates them via the HVACOperationMode enum which contains the following options:
https://github.com/XKNX/xknx/blob/9790cdb696285b5700ec06c571193a7feeb96a39/xknx/dpt/dpt_hvac_mode.py#L10-L30

@MartinHjelmare
Copy link
Member

What's the status here?

Technically this change looks alright since the config option is just to set an option in the xkxn library. The option items are also the names used in xknx and not the Home Assistant presets or HVAC modes. So I'm not sure it would be more clear for users to split the options in presets and modes.

@elupus
Copy link
Contributor

elupus commented Apr 17, 2020

I think we can merge this for now if @FredericMa

@FredericMa
Copy link
Contributor Author

All OK for me.

@MartinHjelmare
Copy link
Member

Please open a PR to our docs repo and link that PR in the PR description here. Then we can merge.

@FredericMa
Copy link
Contributor Author

You mean, extend the docs a bit to make this change more clear? Will do.

FredericMa added a commit to FredericMa/home-assistant.io that referenced this pull request Apr 17, 2020
This change makes the overriding of the supported operation_modes in the KNX Climate integration more clear.
See home-assistant/core#33068 for the related PR.
@FredericMa
Copy link
Contributor Author

Updated the docs.

@MartinHjelmare MartinHjelmare merged commit 71c8fce into home-assistant:dev Apr 18, 2020
@FredericMa FredericMa deleted the fix-knx-operationmodes branch April 18, 2020 15:27
@lock lock bot locked and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed integration: knx small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants