-
-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
ZHA - Event foundation #19095
ZHA - Event foundation #19095
Conversation
@callback | ||
def zha_send_event(self, cluster, command, args): | ||
"""Relay entity events to hass.""" | ||
self.hass.bus.async_fire( |
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.
Entities shouldn't fire custom events. They already spawn state changed events. Devices that need to fire events should not be entities and the events should be fired from the zha component.
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.
See DeconzEvent
in the deconz package for an example.
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 had it like that at first... may I ask why this is the case? I can do that but all it does is artificially increase the number of objects being managed. These entities are going to exist anyway and there will be a platform level event object for each one as well. I thought this was a much cleaner implementation.
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.
How do you mean platform level event?
Entities provide states, and should not fire other types of events.
If entities are not providing states, they should not be entities. What's the case here?
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.
Some do both... in the case of the Aqara Qube for instance. The entity tracks the last motion of the cube but it fires events for things like slide, knock, rotate etc. The entities aren’t all or always firing events... this just adds a hook there to allow them to fire events in the case where an event makes more sense
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 reworked this. Let me know what you think.
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.
changes pushed
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.
Looks good!
Description:
Adds a foundation that allows ZHA entities to fire events in HA