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
Add KNX service exposure_register #45257
Merged
bdraco
merged 12 commits into
home-assistant:dev
from
farmio:xknx-0.16.1-service-expose
Feb 22, 2021
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
76e18ed
move KNXExpose classes to own module expose.py
farmio 0955dc3
create exposures after starting xknx
farmio 335dd41
HA service to add/remove knx exposure
farmio 1de7ba5
review suggestion
farmio 0e285f4
Update __init__.py
farmio 2becdcb
Merge branch 'dev' into xknx-0.16.1-service-expose
farmio 49f1f91
review
farmio e797462
review duplicate code
farmio 3bc92e6
callback
farmio c398375
Merge remote-tracking branch 'upstream/dev' into xknx-0.16.1-service-…
farmio 5455c42
service.yaml schema update
farmio 0ee5b18
add "optional" to description; add reload description
farmio File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a risk to use a config schema as base for a service schema. The constants are different and may change independently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention was that if it was changed in one place (the config schema) the change is automatically applied to the service - as the service calls the exact same functions as the config
create_knx_exposure(self.hass, self.xknx, call.data)
from service andcreate_knx_exposure(hass, hass.data[DOMAIN].xknx, expose_config)
from configThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but that only works safely if the constants are the same, which they aren't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand. Which constants differ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SERVICE_KNX_ATTR_ADDRESS
andCONF_KNX_EXPOSE_ADDRESS
. They have the same value currently.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok. Would it be ok to just use the same constant here imported from .const?
Or should I refactor to pass only Optional[str] to create_knx_exposure instead of call.data / expose_config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linking to the same constant could be ok. The details of knx are fuzzy to me so I can't say better about the other suggestion.