mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
parent
7076ba7c9d
commit
a9ff5b8007
@ -7,7 +7,7 @@ from dataclasses import dataclass
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pyheos import Heos, HeosError, HeosPlayer, const as heos_const
|
from pyheos import Heos, HeosError, HeosOptions, HeosPlayer, const as heos_const
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_HOST, EVENT_HOMEASSISTANT_STOP, Platform
|
from homeassistant.const import CONF_HOST, EVENT_HOMEASSISTANT_STOP, Platform
|
||||||
@ -58,9 +58,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: HeosConfigEntry) -> bool
|
|||||||
host = entry.data[CONF_HOST]
|
host = entry.data[CONF_HOST]
|
||||||
# Setting all_progress_events=False ensures that we only receive a
|
# Setting all_progress_events=False ensures that we only receive a
|
||||||
# media position update upon start of playback or when media changes
|
# media position update upon start of playback or when media changes
|
||||||
controller = Heos(host, all_progress_events=False)
|
controller = Heos(HeosOptions(host, all_progress_events=False, auto_reconnect=True))
|
||||||
try:
|
try:
|
||||||
await controller.connect(auto_reconnect=True)
|
await controller.connect()
|
||||||
# Auto reconnect only operates if initial connection was successful.
|
# Auto reconnect only operates if initial connection was successful.
|
||||||
except HeosError as error:
|
except HeosError as error:
|
||||||
await controller.disconnect()
|
await controller.disconnect()
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from pyheos import Heos, HeosError
|
from pyheos import Heos, HeosError, HeosOptions
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components import ssdp
|
from homeassistant.components import ssdp
|
||||||
@ -20,7 +20,7 @@ def format_title(host: str) -> str:
|
|||||||
|
|
||||||
async def _validate_host(host: str, errors: dict[str, str]) -> bool:
|
async def _validate_host(host: str, errors: dict[str, str]) -> bool:
|
||||||
"""Validate host is reachable, return True, otherwise populate errors and return False."""
|
"""Validate host is reachable, return True, otherwise populate errors and return False."""
|
||||||
heos = Heos(host)
|
heos = Heos(HeosOptions(host, events=False, heart_beat=False))
|
||||||
try:
|
try:
|
||||||
await heos.connect()
|
await heos.connect()
|
||||||
except HeosError:
|
except HeosError:
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/heos",
|
"documentation": "https://www.home-assistant.io/integrations/heos",
|
||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"loggers": ["pyheos"],
|
"loggers": ["pyheos"],
|
||||||
"requirements": ["pyheos==0.7.2"],
|
"requirements": ["pyheos==0.8.0"],
|
||||||
"single_config_entry": true,
|
"single_config_entry": true,
|
||||||
"ssdp": [
|
"ssdp": [
|
||||||
{
|
{
|
||||||
|
@ -1962,7 +1962,7 @@ pygti==0.9.4
|
|||||||
pyhaversion==22.8.0
|
pyhaversion==22.8.0
|
||||||
|
|
||||||
# homeassistant.components.heos
|
# homeassistant.components.heos
|
||||||
pyheos==0.7.2
|
pyheos==0.8.0
|
||||||
|
|
||||||
# homeassistant.components.hive
|
# homeassistant.components.hive
|
||||||
pyhiveapi==0.5.16
|
pyhiveapi==0.5.16
|
||||||
|
@ -1591,7 +1591,7 @@ pygti==0.9.4
|
|||||||
pyhaversion==22.8.0
|
pyhaversion==22.8.0
|
||||||
|
|
||||||
# homeassistant.components.heos
|
# homeassistant.components.heos
|
||||||
pyheos==0.7.2
|
pyheos==0.8.0
|
||||||
|
|
||||||
# homeassistant.components.hive
|
# homeassistant.components.hive
|
||||||
pyhiveapi==0.5.16
|
pyhiveapi==0.5.16
|
||||||
|
@ -15,6 +15,7 @@ from pyheos import (
|
|||||||
const,
|
const,
|
||||||
)
|
)
|
||||||
import pytest
|
import pytest
|
||||||
|
import pytest_asyncio
|
||||||
|
|
||||||
from homeassistant.components import ssdp
|
from homeassistant.components import ssdp
|
||||||
from homeassistant.components.heos import DOMAIN
|
from homeassistant.components.heos import DOMAIN
|
||||||
@ -142,8 +143,8 @@ def input_sources_fixture() -> Sequence[InputSource]:
|
|||||||
return [source]
|
return [source]
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="dispatcher")
|
@pytest_asyncio.fixture(name="dispatcher")
|
||||||
def dispatcher_fixture() -> Dispatcher:
|
async def dispatcher_fixture() -> Dispatcher:
|
||||||
"""Create a dispatcher for testing."""
|
"""Create a dispatcher for testing."""
|
||||||
return Dispatcher()
|
return Dispatcher()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user