Various fixes
This commit is contained in:
parent
308f6febd2
commit
b7eb237632
@ -46,7 +46,6 @@ def handle_update(hass, connection, msg):
|
|||||||
|
|
||||||
class BrowserModEntity(Entity):
|
class BrowserModEntity(Entity):
|
||||||
def __init__(self, hass, deviceID, alias=None):
|
def __init__(self, hass, deviceID, alias=None):
|
||||||
self._hass = hass
|
|
||||||
self._deviceID = deviceID
|
self._deviceID = deviceID
|
||||||
self._alias = alias
|
self._alias = alias
|
||||||
self._ws_data = {}
|
self._ws_data = {}
|
||||||
@ -66,15 +65,18 @@ class BrowserModEntity(Entity):
|
|||||||
_LOGGER.error(f"Connecting {self.entity_id}")
|
_LOGGER.error(f"Connecting {self.entity_id}")
|
||||||
self.ws_send("update")
|
self.ws_send("update")
|
||||||
connection.subscriptions[cid] = self.ws_disconnect
|
connection.subscriptions[cid] = self.ws_disconnect
|
||||||
|
if self.hass:
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def ws_disconnect(self):
|
def ws_disconnect(self):
|
||||||
self._ws_cid = None
|
self._ws_cid = None
|
||||||
self._ws_connection = None
|
self._ws_connection = None
|
||||||
|
if self.hass:
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def ws_update(self, data):
|
def ws_update(self, data):
|
||||||
self._ws_data = data
|
self._ws_data = data
|
||||||
|
if self.hass:
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from homeassistant.components.media_player import (
|
from homeassistant.components.media_player import (
|
||||||
SUPPORT_PLAY, SUPPORT_PLAY_MEDIA, SUPPORT_PAUSE, SUPPORT_STOP,
|
SUPPORT_PLAY, SUPPORT_PLAY_MEDIA,
|
||||||
|
SUPPORT_PAUSE, SUPPORT_STOP,
|
||||||
SUPPORT_VOLUME_SET, SUPPORT_VOLUME_MUTE,
|
SUPPORT_VOLUME_SET, SUPPORT_VOLUME_MUTE,
|
||||||
MediaPlayerDevice,
|
MediaPlayerDevice,
|
||||||
)
|
)
|
||||||
@ -53,7 +54,11 @@ class BrowserModPlayer(MediaPlayerDevice, BrowserModEntity):
|
|||||||
return None
|
return None
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
return 0
|
return (
|
||||||
|
SUPPORT_PLAY | SUPPORT_PLAY_MEDIA |
|
||||||
|
SUPPORT_PAUSE | SUPPORT_STOP |
|
||||||
|
SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE
|
||||||
|
)
|
||||||
@property
|
@property
|
||||||
def volume_level(self):
|
def volume_level(self):
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user