Files
Linkplay2020 fa57f72f37 Add WiiM media player integration (#148948)
Co-authored-by: Tao Jiang <tao.jiang@linkplay.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Joostlek <joostlek@outlook.com>
2026-03-19 18:33:53 +01:00

37 lines
1.2 KiB
Python

"""Base entity for the WiiM integration."""
from __future__ import annotations
from wiim.wiim_device import WiimDevice
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.entity import Entity
from .const import DOMAIN
class WiimBaseEntity(Entity):
"""Base representation of a WiiM entity."""
_attr_has_entity_name = True
def __init__(self, wiim_device: WiimDevice) -> None:
"""Initialize the WiiM base entity."""
self._device = wiim_device
self._attr_device_info = dr.DeviceInfo(
identifiers={(DOMAIN, self._device.udn)},
name=self._device.name,
manufacturer=self._device.manufacturer,
model=self._device.model_name,
sw_version=self._device.firmware_version,
)
if self._device.presentation_url:
self._attr_device_info["configuration_url"] = self._device.presentation_url
elif self._device.http_api_url:
self._attr_device_info["configuration_url"] = self._device.http_api_url
@property
def available(self) -> bool:
"""Return True if entity is available."""
return self._device.available