Async syntax 4/8 (#17018)
* Async syntax 4, media_player & notify * Pylint fixes
This commit is contained in:
parent
3b5e5cbcd6
commit
134eeecd65
17 changed files with 212 additions and 314 deletions
|
@ -4,7 +4,6 @@ Kodi notification service.
|
|||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/notify.kodi/
|
||||
"""
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
import aiohttp
|
||||
|
@ -38,8 +37,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||
ATTR_DISPLAYTIME = 'displaytime'
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_get_service(hass, config, discovery_info=None):
|
||||
async def async_get_service(hass, config, discovery_info=None):
|
||||
"""Return the notify service."""
|
||||
url = '{}:{}'.format(config.get(CONF_HOST), config.get(CONF_PORT))
|
||||
|
||||
|
@ -86,8 +84,7 @@ class KodiNotificationService(BaseNotificationService):
|
|||
|
||||
self._server = jsonrpc_async.Server(self._url, **kwargs)
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_send_message(self, message="", **kwargs):
|
||||
async def async_send_message(self, message="", **kwargs):
|
||||
"""Send a message to Kodi."""
|
||||
import jsonrpc_async
|
||||
try:
|
||||
|
@ -96,7 +93,7 @@ class KodiNotificationService(BaseNotificationService):
|
|||
displaytime = data.get(ATTR_DISPLAYTIME, 10000)
|
||||
icon = data.get(ATTR_ICON, "info")
|
||||
title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)
|
||||
yield from self._server.GUI.ShowNotification(
|
||||
await self._server.GUI.ShowNotification(
|
||||
title, message, icon, displaytime)
|
||||
|
||||
except jsonrpc_async.TransportError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue