From 420bdedcb5ef0cb9110690e2cb0cc2a41e88e685 Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:38:06 +0200 Subject: [PATCH] Small improvements to linkplay from reviews (#125766) Small improvements --- homeassistant/components/linkplay/const.py | 2 +- homeassistant/components/linkplay/media_player.py | 5 ++--- homeassistant/components/linkplay/utils.py | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/linkplay/const.py b/homeassistant/components/linkplay/const.py index 91a427d5eb8..f531e311f46 100644 --- a/homeassistant/components/linkplay/const.py +++ b/homeassistant/components/linkplay/const.py @@ -4,4 +4,4 @@ from homeassistant.const import Platform DOMAIN = "linkplay" PLATFORMS = [Platform.MEDIA_PLAYER] -CONF_SESSION = "session" +DATA_SESSION = "session" diff --git a/homeassistant/components/linkplay/media_player.py b/homeassistant/components/linkplay/media_player.py index 0e29a7f27d0..02341f99970 100644 --- a/homeassistant/components/linkplay/media_player.py +++ b/homeassistant/components/linkplay/media_player.py @@ -177,9 +177,8 @@ class LinkPlayMediaPlayerEntity(MediaPlayerEntity): ] manufacturer, model = get_info_from_project(bridge.device.properties["project"]) - if model == MANUFACTURER_GENERIC: - model_id = None - else: + model_id = None + if model != MANUFACTURER_GENERIC: model_id = bridge.device.properties["project"] self._attr_device_info = dr.DeviceInfo( diff --git a/homeassistant/components/linkplay/utils.py b/homeassistant/components/linkplay/utils.py index 7f15e297145..36a492f8464 100644 --- a/homeassistant/components/linkplay/utils.py +++ b/homeassistant/components/linkplay/utils.py @@ -8,7 +8,7 @@ from linkplay.utils import async_create_unverified_client_session from homeassistant.const import EVENT_HOMEASSISTANT_CLOSE from homeassistant.core import Event, HomeAssistant, callback -from .const import CONF_SESSION, DOMAIN +from .const import DATA_SESSION, DOMAIN MANUFACTURER_ARTSOUND: Final[str] = "ArtSound" MANUFACTURER_ARYLIC: Final[str] = "Arylic" @@ -57,7 +57,7 @@ def get_info_from_project(project: str) -> tuple[str, str]: async def async_get_client_session(hass: HomeAssistant) -> ClientSession: """Get a ClientSession that can be used with LinkPlay devices.""" hass.data.setdefault(DOMAIN, {}) - if CONF_SESSION not in hass.data[DOMAIN]: + if DATA_SESSION not in hass.data[DOMAIN]: clientsession: ClientSession = await async_create_unverified_client_session() @callback @@ -66,8 +66,8 @@ async def async_get_client_session(hass: HomeAssistant) -> ClientSession: clientsession.detach() hass.bus.async_listen_once(EVENT_HOMEASSISTANT_CLOSE, _async_close_websession) - hass.data[DOMAIN][CONF_SESSION] = clientsession + hass.data[DOMAIN][DATA_SESSION] = clientsession return clientsession - session: ClientSession = hass.data[DOMAIN][CONF_SESSION] + session: ClientSession = hass.data[DOMAIN][DATA_SESSION] return session