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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MQTT binary switch #18389

merged 1 commit into from Nov 12, 2018


None yet
4 participants

dgomes commented Nov 12, 2018


I was getting this in my log files:

2018-11-12 00:21:26 WARNING (MainThread) [homeassistant.core] Unable to remove unknown listener <function async_track_point_in_utc_time.<locals>.point_in_time_listener at 0x102948378>

After some analysis I reached binary_sensor/mqtt line 157 where an async callback was supposed to be called in order to cancel an evt.async_call_later.

The proper fix would have been to await for self._delay_listener() but we are outside async function.

This patch fixes the warning, but I'm not sure if it is the right approach 馃槥

Related issue (if applicable): fixes #

Pull request in with documentation (if applicable): home-assistant/< PR number goes here>

Example entry for configuration.yaml (if applicable):

  - platform: mqtt
    state_topic: "test/1"
    payload_on: 1
    payload_off: 0
    name: test_mqtt_delay_off
    device_class: motion
    off_delay: 5
mosquitto_pub -h -t test/1 -m 1 && mosquitto_pub -h -t test/1 -m 0


  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

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

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

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/
  • New files were added to .coveragerc.

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.82.1 milestone Nov 12, 2018


This comment has been minimized.


amelchio commented Nov 12, 2018

That looks right, the await sounds wrong :)

@amelchio amelchio merged commit 0ab81b0 into home-assistant:dev Nov 12, 2018

5 checks passed

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

@wafflebot wafflebot bot removed the in progress label Nov 12, 2018


This comment has been minimized.


dgomes commented Nov 12, 2018

but setting the callback to None was part of the callback. 馃し鈥嶁檪锔

It does work 馃槃 Tks!


This comment has been minimized.


amelchio commented Nov 12, 2018

It sounds like you are mixing up self._delay_listener() and self.off_delay_listener(). The latter is not called when you manually call the former.

zxdavb added a commit to zxdavb/home-assistant that referenced this pull request Nov 13, 2018

balloob added a commit that referenced this pull request Nov 15, 2018

@balloob balloob referenced this pull request Nov 15, 2018


0.82.1 #18481

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