Skip to content

Commit

Permalink
Add speaker mac to device connections #379
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Nov 6, 2023
1 parent f2276e2 commit 048f15a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions custom_components/yandex_station/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from homeassistant.const import STATE_PLAYING, STATE_PAUSED, STATE_IDLE
from homeassistant.core import callback
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.device_registry import DeviceRegistry
from homeassistant.helpers.device_registry import DeviceRegistry, CONNECTION_NETWORK_MAC
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.template import Template
from homeassistant.util import dt
Expand Down Expand Up @@ -249,9 +249,11 @@ def __init__(self, quasar: YandexQuasar, device: dict):
identifiers={(DOMAIN, self.unique_id)},
name=self.device["name"],
)
if self.device_platform in CUSTOM:
info["manufacturer"] = CUSTOM[self.device_platform][1]
info["model"] = CUSTOM[self.device_platform][2]
if custom := CUSTOM.get(self.device_platform):
info["manufacturer"] = custom[1]
info["model"] = custom[2]
if mac := device.get("mac"):
info["connections"] = {(CONNECTION_NETWORK_MAC, mac)}

# backward compatibility
self.entity_id = "media_player."
Expand Down

0 comments on commit 048f15a

Please sign in to comment.