Skip to content

Fire events for ISY994 control events#10664

Closed
OverloadUT wants to merge 5 commits intohome-assistant:devfrom
OverloadUT:isy994-control-events
Closed

Fire events for ISY994 control events#10664
OverloadUT wants to merge 5 commits intohome-assistant:devfrom
OverloadUT:isy994-control-events

Conversation

@OverloadUT
Copy link
Copy Markdown
Contributor

@OverloadUT OverloadUT commented Nov 18, 2017

Description:

A very small code change that massively increases the capability of Hass in an ISY994 household.

Before, Hass was only aware of the state change on all Insteon devices. With this change, Hass emits events every time a "Control" event happens in the Insteon network regardless of what state changes resulted from that Control.

  • This can be useful, for example, to tell when a light switch is pressed "on" even though the status of that switch is already on.
  • More excitingly, it allows the capture of "Fast On" and "Fast Off" events, which the user does by double-tapping the switch on or off. This is a great way for users to set up automations that occur when a double-tap happens.
  • Even more excitingly this allows Insteon remotes, which are nice small remotes with up to 8 buttons, to function as buttons directly within Hass, rather than requiring them to be bound to scenes or devices and relying on their status updates.

There are also some changes here to support UNKNOWN states from ISY, which is a PyISY breaking change in the new version that this PR utilizes.

Pull request in home-assistant.github.io with documentation (if applicable): Documentation update will be needed, pending approval of the event-based approach here.

Example entry for configuration.yaml (if applicable):

automation:
  - alias: turn off living room on double tap off of switch near garage
    trigger:
      platform: event
      event_type: isy994_control
      event_data:
        entity_id: light.lr_track_lights_front_slave
        control: 'DFOF'
    action:
      service: light.turn_off
      entity_id: light.lr_track_lights_rear

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass (NO ISY994 TESTS EXIST)
  • New dependencies have been added to the REQUIREMENTS variable ([example][ex-requir]). (pending PyISY version update)
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py. (pending PyISY version update)

This allows hass to react directly to Insteon button presses (on switches and remotes), including presses, double-presses, and long holds
@OverloadUT OverloadUT requested a review from rmkraus November 18, 2017 22:34
@balloob balloob changed the title Fire events for ISY994 control events WIP Fire events for ISY994 control events Nov 18, 2017
@OverloadUT OverloadUT mentioned this pull request Nov 26, 2017
5 tasks
The event handler method requires `self.hass` to exist, which doesn't have a value until the async_added_to_hass method is called. Should eliminate a race condition.
PyISY will report unknown states as the number "-inf". This is implemented in the base ISY994 component, but subcomponents that override the `state` method needed some extra logic to handle it as well.
@OverloadUT OverloadUT changed the title WIP Fire events for ISY994 control events Fire events for ISY994 control events Dec 8, 2017
@OverloadUT
Copy link
Copy Markdown
Contributor Author

Removed the WIP tag. This PR is now ready for full review now that the PyISY library published version 1.1.0

@OverloadUT
Copy link
Copy Markdown
Contributor Author

Closing, as everything here will be part of #10805

@OverloadUT OverloadUT closed this Dec 9, 2017
@OverloadUT OverloadUT deleted the isy994-control-events branch December 13, 2017 20:40
@home-assistant home-assistant locked and limited conversation to collaborators Mar 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants