mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
parent
7076ba7c9d
commit
a9ff5b8007
@ -7,7 +7,7 @@ from dataclasses import dataclass
|
||||
from datetime import timedelta
|
||||
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.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]
|
||||
# Setting all_progress_events=False ensures that we only receive a
|
||||
# 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:
|
||||
await controller.connect(auto_reconnect=True)
|
||||
await controller.connect()
|
||||
# Auto reconnect only operates if initial connection was successful.
|
||||
except HeosError as error:
|
||||
await controller.disconnect()
|
||||
|
@ -3,7 +3,7 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from pyheos import Heos, HeosError
|
||||
from pyheos import Heos, HeosError, HeosOptions
|
||||
import voluptuous as vol
|
||||
|
||||
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:
|
||||
"""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:
|
||||
await heos.connect()
|
||||
except HeosError:
|
||||
|
@ -6,7 +6,7 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/heos",
|
||||
"iot_class": "local_push",
|
||||
"loggers": ["pyheos"],
|
||||
"requirements": ["pyheos==0.7.2"],
|
||||
"requirements": ["pyheos==0.8.0"],
|
||||
"single_config_entry": true,
|
||||
"ssdp": [
|
||||
{
|
||||
|
@ -1962,7 +1962,7 @@ pygti==0.9.4
|
||||
pyhaversion==22.8.0
|
||||
|
||||
# homeassistant.components.heos
|
||||
pyheos==0.7.2
|
||||
pyheos==0.8.0
|
||||
|
||||
# homeassistant.components.hive
|
||||
pyhiveapi==0.5.16
|
||||
|
@ -1591,7 +1591,7 @@ pygti==0.9.4
|
||||
pyhaversion==22.8.0
|
||||
|
||||
# homeassistant.components.heos
|
||||
pyheos==0.7.2
|
||||
pyheos==0.8.0
|
||||
|
||||
# homeassistant.components.hive
|
||||
pyhiveapi==0.5.16
|
||||
|
@ -15,6 +15,7 @@ from pyheos import (
|
||||
const,
|
||||
)
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from homeassistant.components import ssdp
|
||||
from homeassistant.components.heos import DOMAIN
|
||||
@ -142,8 +143,8 @@ def input_sources_fixture() -> Sequence[InputSource]:
|
||||
return [source]
|
||||
|
||||
|
||||
@pytest.fixture(name="dispatcher")
|
||||
def dispatcher_fixture() -> Dispatcher:
|
||||
@pytest_asyncio.fixture(name="dispatcher")
|
||||
async def dispatcher_fixture() -> Dispatcher:
|
||||
"""Create a dispatcher for testing."""
|
||||
return Dispatcher()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user