Updated own integrations for new HA version

This commit is contained in:
Martin Bauer
2021-05-01 11:54:54 +00:00
parent 6ee8c9c348
commit f6379fe687
25 changed files with 286 additions and 51 deletions

View File

@@ -6,10 +6,10 @@ import sys
from typing import List, Tuple
import voluptuous as vol
from ..reconnecting_client import ReconnectingClient
from .radio import find_local_radio_url_by_name
from .radio import find_local_radio_url_by_name, fill_station_cache_async
from homeassistant.components.media_player import (
MediaPlayerDevice, PLATFORM_SCHEMA)
MediaPlayerEntity, PLATFORM_SCHEMA)
from homeassistant.components.media_player.const import (
ATTR_MEDIA_ENQUEUE, DOMAIN, MEDIA_TYPE_MUSIC,
SUPPORT_CLEAR_PLAYLIST, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE,
@@ -22,6 +22,7 @@ from homeassistant.const import (
STATE_IDLE, STATE_OFF, STATE_PAUSED, STATE_PLAYING)
import homeassistant.helpers.config_validation as cv
from homeassistant.util.dt import utcnow
from homeassistant.helpers.aiohttp_client import async_get_clientsession
_LOGGER = logging.getLogger(__name__)
@@ -66,6 +67,8 @@ async def async_setup_platform(hass, config, async_add_entities,
discovery_info=None):
"""Set up the squeezebox platform."""
import socket
await fill_station_cache_async(async_get_clientsession(hass))
known_servers = hass.data.get(KNOWN_SERVERS)
if known_servers is None:
@@ -249,7 +252,7 @@ class LogitechMediaServer(ReconnectingClient):
_LOGGER.warning("LMS Ignoring line " + line)
class SqueezeBoxDevice(MediaPlayerDevice):
class SqueezeBoxDevice(MediaPlayerEntity):
"""Representation of a SqueezeBox device."""
def __init__(self, lms, playerid, name, **attributes):