diff --git a/homeassistant/components/heos/__init__.py b/homeassistant/components/heos/__init__.py index b9b9b30a280..a7acd53739f 100644 --- a/homeassistant/components/heos/__init__.py +++ b/homeassistant/components/heos/__init__.py @@ -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() diff --git a/homeassistant/components/heos/config_flow.py b/homeassistant/components/heos/config_flow.py index f861247d1a9..830d708effd 100644 --- a/homeassistant/components/heos/config_flow.py +++ b/homeassistant/components/heos/config_flow.py @@ -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: diff --git a/homeassistant/components/heos/manifest.json b/homeassistant/components/heos/manifest.json index 12f10bcd0e3..20694196e82 100644 --- a/homeassistant/components/heos/manifest.json +++ b/homeassistant/components/heos/manifest.json @@ -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": [ { diff --git a/requirements_all.txt b/requirements_all.txt index b1107bde2c5..55ad03d0c56 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -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 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 284574e0a2c..de7ef4d8bba 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -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 diff --git a/tests/components/heos/conftest.py b/tests/components/heos/conftest.py index 9ea3341304a..7b40ff5f749 100644 --- a/tests/components/heos/conftest.py +++ b/tests/components/heos/conftest.py @@ -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()