Bump pyheos to v0.8.0 (#134069)

Bump pyheos and update usage
This commit is contained in:
Andrew Sayre 2024-12-27 10:01:35 -07:00 committed by GitHub
parent 7076ba7c9d
commit a9ff5b8007
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 10 deletions

View File

@ -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()

View File

@ -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:

View File

@ -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": [
{ {

View File

@ -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

View File

@ -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

View File

@ -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()