mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Change unique_id for webostv (#34979)
* Revert #34656 * Use pairing key as unique_id
This commit is contained in:
parent
d072091926
commit
1e00fc2af7
@ -28,7 +28,6 @@ from homeassistant.const import (
|
|||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.event import async_call_later
|
|
||||||
|
|
||||||
from .const import ATTR_SOUND_OUTPUT
|
from .const import ATTR_SOUND_OUTPUT
|
||||||
|
|
||||||
@ -139,31 +138,16 @@ async def async_setup_tv_finalize(hass, config, conf, client):
|
|||||||
client.clear_state_update_callbacks()
|
client.clear_state_update_callbacks()
|
||||||
await client.disconnect()
|
await client.disconnect()
|
||||||
|
|
||||||
async def async_load_platforms(_):
|
|
||||||
"""Load platforms and event listener."""
|
|
||||||
await async_connect(client)
|
|
||||||
|
|
||||||
if client.connection is None:
|
|
||||||
async_call_later(hass, 60, async_load_platforms)
|
|
||||||
_LOGGER.debug(
|
|
||||||
"No connection could be made with host %s, retrying in 60 seconds",
|
|
||||||
conf.get(CONF_HOST),
|
|
||||||
)
|
|
||||||
return
|
|
||||||
|
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, async_on_stop)
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, async_on_stop)
|
||||||
|
|
||||||
|
await async_connect(client)
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
hass.helpers.discovery.async_load_platform(
|
hass.helpers.discovery.async_load_platform("media_player", DOMAIN, conf, config)
|
||||||
"media_player", DOMAIN, conf, config
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
hass.helpers.discovery.async_load_platform("notify", DOMAIN, conf, config)
|
hass.helpers.discovery.async_load_platform("notify", DOMAIN, conf, config)
|
||||||
)
|
)
|
||||||
|
|
||||||
await async_load_platforms(None)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_request_configuration(hass, config, conf, client):
|
async def async_request_configuration(hass, config, conf, client):
|
||||||
"""Request configuration steps from the user."""
|
"""Request configuration steps from the user."""
|
||||||
|
@ -116,7 +116,7 @@ class LgWebOSMediaPlayerEntity(MediaPlayerEntity):
|
|||||||
"""Initialize the webos device."""
|
"""Initialize the webos device."""
|
||||||
self._client = client
|
self._client = client
|
||||||
self._name = name
|
self._name = name
|
||||||
self._unique_id = client.software_info["device_id"]
|
self._unique_id = client.client_key
|
||||||
self._customize = customize
|
self._customize = customize
|
||||||
self._on_script = on_script
|
self._on_script = on_script
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@ def client_fixture():
|
|||||||
"homeassistant.components.webostv.WebOsClient", autospec=True
|
"homeassistant.components.webostv.WebOsClient", autospec=True
|
||||||
) as mock_client_class:
|
) as mock_client_class:
|
||||||
client = mock_client_class.return_value
|
client = mock_client_class.return_value
|
||||||
client.connection = True
|
|
||||||
client.software_info = {"device_id": "a1:b1:c1:d1:e1:f1"}
|
client.software_info = {"device_id": "a1:b1:c1:d1:e1:f1"}
|
||||||
|
client.client_key = "0123456789"
|
||||||
yield client
|
yield client
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user