Skip to content

Remove warning on script delay#17264

Merged
balloob merged 2 commits intohome-assistant:devfrom
amelchio:remove-listener-warning
Oct 9, 2018
Merged

Remove warning on script delay#17264
balloob merged 2 commits intohome-assistant:devfrom
amelchio:remove-listener-warning

Conversation

@amelchio
Copy link
Copy Markdown
Contributor

@amelchio amelchio commented Oct 8, 2018

Description:

This is another attempt at the fix in #16923.

Apparently I got confused by the naming. The _async_remove_listener() helper actually does more than just remove() the listener. The result is (harmless) warnings about double timer unsubscribes for script delays.

This reworked fix just ignores the exception that could happen if a script is turned on/off right as its timer expires.

Related issue (if applicable): fixes #17204

Example entry for configuration.yaml (if applicable):

script:
 vdr_ambilight_off:
    sequence:
      - service: switch.turn_off
        entity_id: switch.433_hyperion
      - delay: '00:00:02'
      - service: shell_command.easyvdr_off

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@amelchio amelchio added this to the 0.80 milestone Oct 8, 2018
@amelchio amelchio requested a review from a team as a code owner October 8, 2018 20:38
@homeassistant homeassistant added cla-signed core small-pr PRs with less than 30 lines. labels Oct 8, 2018
@ghost ghost assigned amelchio Oct 8, 2018
@ghost ghost added the in progress label Oct 8, 2018
@amelchio amelchio removed their assignment Oct 8, 2018
self._async_listener.remove(unsub)
except ValueError:
pass

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use suppress

try:
self._async_listener.remove(unsub)
except ValueError:
pass
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use suppress

@ghost ghost assigned amelchio Oct 8, 2018
@balloob balloob merged commit 5db7d70 into home-assistant:dev Oct 9, 2018
@ghost ghost removed the in progress label Oct 9, 2018
balloob pushed a commit that referenced this pull request Oct 9, 2018
* Remove warning on script delay

* Use suppress
@balloob balloob mentioned this pull request Oct 12, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Feb 5, 2019
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.

0.80.0b1 - Unable to remove unknown listener

5 participants