diff --git a/homeassistant/components/asterisk_mbox/__init__.py b/homeassistant/components/asterisk_mbox/__init__.py index 6c9412d07d8..1ecba9f4c8f 100644 --- a/homeassistant/components/asterisk_mbox/__init__.py +++ b/homeassistant/components/asterisk_mbox/__init__.py @@ -1,6 +1,12 @@ """Support for Asterisk Voicemail interface.""" import logging +from asterisk_mbox import Client as asteriskClient +from asterisk_mbox.commands import ( + CMD_MESSAGE_CDR, + CMD_MESSAGE_CDR_AVAILABLE, + CMD_MESSAGE_LIST, +) import voluptuous as vol from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT @@ -51,7 +57,6 @@ class AsteriskData: def __init__(self, hass, host, port, password, config): """Init the Asterisk data object.""" - from asterisk_mbox import Client as asteriskClient self.hass = hass self.config = config @@ -76,11 +81,6 @@ class AsteriskData: @callback def handle_data(self, command, msg): """Handle changes to the mailbox.""" - from asterisk_mbox.commands import ( - CMD_MESSAGE_LIST, - CMD_MESSAGE_CDR_AVAILABLE, - CMD_MESSAGE_CDR, - ) if command == CMD_MESSAGE_LIST: _LOGGER.debug("AsteriskVM sent updated message list: Len %d", len(msg)) diff --git a/homeassistant/components/asterisk_mbox/mailbox.py b/homeassistant/components/asterisk_mbox/mailbox.py index 4d3c255fd5b..3cd6fe059b6 100644 --- a/homeassistant/components/asterisk_mbox/mailbox.py +++ b/homeassistant/components/asterisk_mbox/mailbox.py @@ -1,6 +1,8 @@ """Support for the Asterisk Voicemail interface.""" import logging +from asterisk_mbox import ServerError + from homeassistant.components.mailbox import CONTENT_TYPE_MPEG, Mailbox, StreamError from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -50,7 +52,6 @@ class AsteriskMailbox(Mailbox): async def async_get_media(self, msgid): """Return the media blob for the msgid.""" - from asterisk_mbox import ServerError client = self.hass.data[ASTERISK_DOMAIN].client try: