Skip to content

Use device class selector for KNX - #180289

Merged
jbouwh merged 2 commits into
devfrom
knx-use-device_class_selector
Aug 27, 2026
Merged

Use device class selector for KNX#180289
jbouwh merged 2 commits into
devfrom
knx-use-device_class_selector

Conversation

@jbouwh

@jbouwh jbouwh commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Proposed change

Use device class selector for KNX

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

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • 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
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

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.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant

Copy link
Copy Markdown
Contributor

Hey there @Julius2342, @farmio, @marvin-w, mind taking a look at this pull request 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 pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign knx Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

@farmio farmio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! I'll put this to draft until tested in the Knx config panel. Not sure if our version of the frontend already supports that selector.

@home-assistant
home-assistant Bot marked this pull request as draft August 26, 2026 14:33
@home-assistant

Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@jbouwh

jbouwh commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! I'll put this to draft until tested in the Knx config panel. Not sure if our version of the frontend already supports that selector.

The front PR was merged and will be in the beta

@jbouwh
jbouwh marked this pull request as ready for review August 26, 2026 18:04
@home-assistant
home-assistant Bot requested a review from farmio August 26, 2026 18:04
@farmio

farmio commented Aug 26, 2026

Copy link
Copy Markdown
Member

The knx config panel runs in an iframe - it has no access to the core frontend componenes. It needs to ship its own HA frontend.
XKNX/knx-frontend#440 merged, released and a dependency bump in core is needed.

@farmio

farmio commented Aug 26, 2026

Copy link
Copy Markdown
Member

After #180338 it will be fine.

@farmio

farmio commented Aug 26, 2026

Copy link
Copy Markdown
Member

Is it possible to explicitly deselect a device class or set it to None with this selector?

@jbouwh

jbouwh commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Is it possible to explicitly deselect a device class or set it to None with this selector?

The selector is optional. So yes, this allows to clear the device_class value.

@farmio

farmio commented Aug 26, 2026

Copy link
Copy Markdown
Member

Omitting the value results in using the default device_class for the selected datapoint type.
We didn't have the feature to override with None yet - I was just drafting that last week.

Do you think it would be accepted to add a Boolean option to the selector to show an explicit None (none_allowed or so)?

@jbouwh

jbouwh commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Have a look at the MQTT subentry setup by adding an MQTT device. Choose "sensor".
A dialog with an optional device_class selector is shown. Useing the X you can clear the value and allow a null value.

@jbouwh

jbouwh commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

In you current code base the selector is already optional. Also the values are exact the same as in your previous SelectSelector.

@farmio

farmio commented Aug 27, 2026

Copy link
Copy Markdown
Member

Yes right. When it is None, it falls back to the default - which isn't None depending on other config options.

We don't have the override-to-None feature yet. There was another blocker.

@jbouwh
jbouwh merged commit f792037 into dev Aug 27, 2026
35 checks passed
@jbouwh
jbouwh deleted the knx-use-device_class_selector branch August 27, 2026 08:30
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants