Improved async. Fix #97.
This commit is contained in:
parent
59478919f1
commit
350a18bf81
@ -33,7 +33,7 @@ async def async_setup(hass, config):
|
|||||||
|
|
||||||
await setup_connection(hass, config)
|
await setup_connection(hass, config)
|
||||||
|
|
||||||
setup_service(hass)
|
await setup_service(hass)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import logging
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from homeassistant.const import STATE_UNAVAILABLE, STATE_ON, STATE_OFF
|
from homeassistant.const import STATE_UNAVAILABLE, STATE_ON, STATE_OFF
|
||||||
from homeassistant.components.light import Light, SUPPORT_BRIGHTNESS
|
from homeassistant.components.light import LightEntity, SUPPORT_BRIGHTNESS
|
||||||
|
|
||||||
from .helpers import setup_platform, BrowserModEntity
|
from .helpers import setup_platform, BrowserModEntity
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ PLATFORM = 'light'
|
|||||||
async def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
async def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||||
return setup_platform(hass, config, async_add_devices, PLATFORM, BrowserModLight)
|
return setup_platform(hass, config, async_add_devices, PLATFORM, BrowserModLight)
|
||||||
|
|
||||||
class BrowserModLight(Light, BrowserModEntity):
|
class BrowserModLight(LightEntity, BrowserModEntity):
|
||||||
domain = PLATFORM
|
domain = PLATFORM
|
||||||
|
|
||||||
def __init__(self, hass, connection, deviceID, alias=None):
|
def __init__(self, hass, connection, deviceID, alias=None):
|
||||||
|
@ -3,7 +3,7 @@ from homeassistant.components.media_player import (
|
|||||||
SUPPORT_PLAY, SUPPORT_PLAY_MEDIA,
|
SUPPORT_PLAY, SUPPORT_PLAY_MEDIA,
|
||||||
SUPPORT_PAUSE, SUPPORT_STOP,
|
SUPPORT_PAUSE, SUPPORT_STOP,
|
||||||
SUPPORT_VOLUME_SET, SUPPORT_VOLUME_MUTE,
|
SUPPORT_VOLUME_SET, SUPPORT_VOLUME_MUTE,
|
||||||
MediaPlayerDevice,
|
MediaPlayerEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
@ -23,7 +23,7 @@ async def async_setup_platform(hass, config, async_add_devices, discovery_info=N
|
|||||||
return setup_platform(hass, config, async_add_devices, PLATFORM, BrowserModPlayer)
|
return setup_platform(hass, config, async_add_devices, PLATFORM, BrowserModPlayer)
|
||||||
|
|
||||||
|
|
||||||
class BrowserModPlayer(MediaPlayerDevice, BrowserModEntity):
|
class BrowserModPlayer(MediaPlayerEntity, BrowserModEntity):
|
||||||
domain = PLATFORM
|
domain = PLATFORM
|
||||||
|
|
||||||
def __init__(self, hass, connection, deviceID, alias=None):
|
def __init__(self, hass, connection, deviceID, alias=None):
|
||||||
|
@ -3,7 +3,7 @@ from .const import DOMAIN, DATA_DEVICES, DATA_ALIASES, USER_COMMANDS
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
def setup_service(hass):
|
async def setup_service(hass):
|
||||||
|
|
||||||
def handle_command(call):
|
def handle_command(call):
|
||||||
command = call.data.get("command", None)
|
command = call.data.get("command", None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user