mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Update header and make it less verbose (#11774)
This commit is contained in:
parent
526405c83b
commit
23b2ca50e2
@ -1,34 +1,34 @@
|
|||||||
"""Support for Asterisk Voicemail interface."""
|
"""
|
||||||
|
Support for Asterisk Voicemail interface.
|
||||||
|
|
||||||
|
For more details about this component, please refer to the documentation at
|
||||||
|
https://home-assistant.io/components/asterisk_mbox/
|
||||||
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.helpers import discovery
|
|
||||||
from homeassistant.const import (CONF_HOST,
|
|
||||||
CONF_PORT, CONF_PASSWORD)
|
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import (async_dispatcher_connect,
|
from homeassistant.helpers import discovery
|
||||||
async_dispatcher_send)
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.dispatcher import (
|
||||||
|
async_dispatcher_connect, async_dispatcher_send)
|
||||||
|
|
||||||
REQUIREMENTS = ['asterisk_mbox==0.4.0']
|
REQUIREMENTS = ['asterisk_mbox==0.4.0']
|
||||||
|
|
||||||
SIGNAL_MESSAGE_UPDATE = 'asterisk_mbox.message_updated'
|
_LOGGER = logging.getLogger(__name__)
|
||||||
SIGNAL_MESSAGE_REQUEST = 'asterisk_mbox.message_request'
|
|
||||||
|
|
||||||
DOMAIN = 'asterisk_mbox'
|
DOMAIN = 'asterisk_mbox'
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
SIGNAL_MESSAGE_REQUEST = 'asterisk_mbox.message_request'
|
||||||
|
SIGNAL_MESSAGE_UPDATE = 'asterisk_mbox.message_updated'
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema({
|
CONFIG_SCHEMA = vol.Schema({
|
||||||
DOMAIN: vol.Schema({
|
DOMAIN: vol.Schema({
|
||||||
vol.Required(CONF_HOST): cv.string,
|
vol.Required(CONF_HOST): cv.string,
|
||||||
vol.Required(CONF_PORT): int,
|
|
||||||
vol.Required(CONF_PASSWORD): cv.string,
|
vol.Required(CONF_PASSWORD): cv.string,
|
||||||
|
vol.Required(CONF_PORT): int,
|
||||||
}),
|
}),
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ def setup(hass, config):
|
|||||||
|
|
||||||
hass.data[DOMAIN] = AsteriskData(hass, host, port, password)
|
hass.data[DOMAIN] = AsteriskData(hass, host, port, password)
|
||||||
|
|
||||||
discovery.load_platform(hass, "mailbox", DOMAIN, {}, config)
|
discovery.load_platform(hass, 'mailbox', DOMAIN, {}, config)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -68,15 +68,14 @@ class AsteriskData(object):
|
|||||||
from asterisk_mbox.commands import CMD_MESSAGE_LIST
|
from asterisk_mbox.commands import CMD_MESSAGE_LIST
|
||||||
|
|
||||||
if command == CMD_MESSAGE_LIST:
|
if command == CMD_MESSAGE_LIST:
|
||||||
_LOGGER.info("AsteriskVM sent updated message list")
|
_LOGGER.debug("AsteriskVM sent updated message list")
|
||||||
self.messages = sorted(msg,
|
self.messages = sorted(
|
||||||
key=lambda item: item['info']['origtime'],
|
msg, key=lambda item: item['info']['origtime'], reverse=True)
|
||||||
reverse=True)
|
async_dispatcher_send(
|
||||||
async_dispatcher_send(self.hass, SIGNAL_MESSAGE_UPDATE,
|
self.hass, SIGNAL_MESSAGE_UPDATE, self.messages)
|
||||||
self.messages)
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _request_messages(self):
|
def _request_messages(self):
|
||||||
"""Handle changes to the mailbox."""
|
"""Handle changes to the mailbox."""
|
||||||
_LOGGER.info("Requesting message list")
|
_LOGGER.debug("Requesting message list")
|
||||||
self.client.messages()
|
self.client.messages()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user