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

Merged
merged 5 commits into from Dec 10, 2018

Conversation

Projects
None yet
5 participants
@dmulcahey
Copy link
Contributor

dmulcahey commented Dec 7, 2018

Description:

Adds a foundation that allows ZHA entities to fire events in HA

@wafflebot wafflebot bot added the in progress label Dec 7, 2018

@dmulcahey dmulcahey changed the title event foundation ZHA - Event foundation Dec 7, 2018

@dmulcahey dmulcahey closed this Dec 7, 2018

@wafflebot wafflebot bot removed the in progress label Dec 7, 2018

@dmulcahey dmulcahey reopened this Dec 7, 2018

@wafflebot wafflebot bot added the in progress label Dec 7, 2018

@callback
def zha_send_event(self, cluster, command, args):
"""Relay entity events to hass."""
self.hass.bus.async_fire(

This comment has been minimized.

@MartinHjelmare

MartinHjelmare Dec 9, 2018

Member

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.

This comment has been minimized.

@MartinHjelmare

MartinHjelmare Dec 9, 2018

Member

See DeconzEvent in the deconz package for an example.

This comment has been minimized.

@dmulcahey

dmulcahey Dec 9, 2018

Contributor

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.

This comment has been minimized.

@MartinHjelmare

MartinHjelmare Dec 9, 2018

Member

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?

This comment has been minimized.

@dmulcahey

dmulcahey Dec 9, 2018

Contributor

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

This comment has been minimized.

@dmulcahey

dmulcahey Dec 10, 2018

Contributor

I reworked this. Let me know what you think.

This comment has been minimized.

@dmulcahey

dmulcahey Dec 10, 2018

Contributor

changes pushed

@dmulcahey dmulcahey closed this Dec 9, 2018

@wafflebot wafflebot bot removed the in progress label Dec 9, 2018

@dmulcahey dmulcahey changed the title ZHA - Event foundation WIP - ZHA - Event foundation Dec 10, 2018

@dmulcahey dmulcahey reopened this Dec 10, 2018

@wafflebot wafflebot bot added the in progress label Dec 10, 2018

Show resolved Hide resolved homeassistant/components/zha/event.py Outdated
Show resolved Hide resolved homeassistant/components/zha/event.py Outdated
Show resolved Hide resolved homeassistant/components/zha/event.py Outdated
Show resolved Hide resolved homeassistant/components/zha/__init__.py Outdated
Show resolved Hide resolved homeassistant/components/zha/event.py Outdated
Show resolved Hide resolved homeassistant/components/zha/event.py
@MartinHjelmare
Copy link
Member

MartinHjelmare left a comment

Looks good!

@dmulcahey dmulcahey changed the title WIP - ZHA - Event foundation ZHA - Event foundation Dec 10, 2018

@cgarwood cgarwood merged commit f4f4217 into home-assistant:dev Dec 10, 2018

5 checks passed

Hound No violations found. Woof!
WIP Legacy commit status override — see details
Details
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.01%) to 92.946%
Details

@wafflebot wafflebot bot removed the in progress label Dec 10, 2018

mxworm added a commit to mxworm/home-assistant that referenced this pull request Dec 11, 2018

Merge branch 'dev' into current
* dev: (26 commits)
  Move daikin to package (home-assistant#19187)
  Restore states for RFLink devices (home-assistant#18816)
  Add SCAN_INTERVAL (home-assistant#19186)
  Enable alarmdecoder to see open/close state of bypassed RF zones when armed (home-assistant#18477)
  Updated frontend to 20181211.0
  Fix cloud defaults (home-assistant#19172)
  TelldusLive config flow (home-assistant#18758)
  ZHA - Event foundation (home-assistant#19095)
  Add raw service data to event (home-assistant#19163)
  Updated frontend to 20181210.1
  Google assistant fix target temp for *F values. (home-assistant#19083)
  Fix lovelace save (home-assistant#19162)
  Drop OwnTracks bad packets (home-assistant#19161)
  Update translations
  Updated frontend to 20181210.0
  Lovelace using storage (home-assistant#19101)
  Update pygtfs to upstream's 0.1.5 (home-assistant#19151)
  Update radiotherm to 2.0.0 and handle change in tstat error detection (home-assistant#19107)
  Upgrade sphinx-autodoc-typehints to 1.5.2 (home-assistant#19140)
  Update geizhals dependency (home-assistant#19152)
  ...

@dmulcahey dmulcahey deleted the dmulcahey:dm/zha-event-foundation branch Dec 26, 2018

@balloob balloob referenced this pull request Jan 10, 2019

Merged

0.85.0 #19897

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment