-
Notifications
You must be signed in to change notification settings - Fork 10
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
WIP: program added/removed events #48
base: master
Are you sure you want to change the base?
Conversation
For the sake of completeness should we have a de-register callback too? Should there be a different event for "rename"? Can you open a proof on concept on the HA side too? |
@@ -67,6 +68,9 @@ def _get_data_flag_bits(self): | |||
def _set_data_flag_bit(self, index, value): | |||
print("foo") | |||
|
|||
def add_on_removed_observer(self, observer): |
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.
technically it is both add and remove so the name is a bit off
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.
This is actually just remove. Chicken/egg for added.
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.
Meaning if you’re adding a callback for added on a program...the program is already added (in the context of a program instance).
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.
yea but you have both "added" and "removed" "events". Maybe just add_observer
?
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 event on the program directly is only removed..
The controller callback serves both added and removed. For simplicity I think it would be difficult try to manage a rename/modify event and would probably stick with a modify is a remove and subsequent add. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This allows registering callbacks for 2 different scenarios:
Example usage:
The callback directly on the
program
will make it easier to bind anentity
to the removal process and deregister the entity withhass
in a more self-contained manner.