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

Adds support for unique id #576

Merged
merged 5 commits into from Mar 29, 2021
Merged

Adds support for unique id #576

merged 5 commits into from Mar 29, 2021

Conversation

marvin-w
Copy link
Member

Description

This PR adds experimental (opt-in) support for unique ids within the KNX platform. Since XKNX natively does not have the ability to provide unique ids we created our own ones based on data that we think might be unique across an installation.

This PR is tested and working correctly on my local test setup:

image

You can see that with the unique_id feature turned on you can set customize the entity to your liking.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have performed a self-review of my own code
  • The documentation has been adjusted accordingly
  • The changes generate no new warnings
  • Tests have been added that prove the fix is effective or that the feature works
  • The changes are documented in the changelog
  • The Homeassistant plugin has been adjusted in case of new config options

@coveralls
Copy link

coveralls commented Jan 25, 2021

Coverage Status

Coverage decreased (-0.2%) to 94.743% when pulling a656bf2 on marvin-w:feature/unique_id into 63d2630 on XKNX:main.

@marvin-w marvin-w requested a review from farmio January 25, 2021 22:38
xknx/devices/scene.py Outdated Show resolved Hide resolved
xknx/devices/light.py Outdated Show resolved Hide resolved
@farmio
Copy link
Member

farmio commented Feb 20, 2021

🤔 when we add value_template to Sensor and BinarySensor users could be tempted to create multiple Entities with the same state_address but different value_templates. This would result in UID duplicates.

@marvin-w
Copy link
Member Author

marvin-w commented Feb 28, 2021

@farmio How should we continue here?

For the value_template stuff - we could just add the value template to the unique_id for sensors

Base automatically changed from master to main March 12, 2021 13:07
@marvin-w
Copy link
Member Author

I adjusted the unique id for scenes to include the scene number.

As the value_template stuff has been declined by HA upstream I would not worry about it too much.

@kifort
Copy link

kifort commented May 16, 2021

Big thank you @marvin-w! I can finally start using the home assistant areas with KNX :)

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.

None yet

5 participants