Skip to content
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

Fix MQTT async_added_to_hass #18575

Merged
merged 2 commits into from Nov 19, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/components/alarm_control_panel/manual_mqtt.py
Expand Up @@ -335,7 +335,7 @@ def device_state_attributes(self):

return state_attr

def async_added_to_hass(self):
async def async_added_to_hass(self):
"""Subscribe to MQTT events.

This method must be run in the event loop and returns a coroutine.
balloob marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -359,7 +359,7 @@ def message_received(topic, payload, qos):
_LOGGER.warning("Received unexpected payload: %s", payload)
return

return mqtt.async_subscribe(
await mqtt.async_subscribe(
self.hass, self._command_topic, message_received, self._qos)

async def _async_state_changed_listener(self, entity_id, old_state,
Expand Down
5 changes: 2 additions & 3 deletions homeassistant/components/camera/mqtt.py
Expand Up @@ -89,13 +89,12 @@ def unique_id(self):
"""Return a unique ID."""
return self._unique_id

@asyncio.coroutine
def async_added_to_hass(self):
async def async_added_to_hass(self):
"""Subscribe MQTT events."""
@callback
def message_received(topic, payload, qos):
"""Handle new MQTT messages."""
self._last_image = payload

return mqtt.async_subscribe(
await mqtt.async_subscribe(
self.hass, self._topic, message_received, self._qos, None)