Set connection and command timeout in VLC Telnet (#126401)

use 1s lower than scan interval
This commit is contained in:
Michael 2024-09-21 21:11:17 +02:00 committed by GitHub
parent 505fb3738f
commit 9bfc2eaeb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,6 +5,9 @@ from dataclasses import dataclass
from aiovlc.client import Client
from aiovlc.exceptions import AuthError, ConnectError
from homeassistant.components.media_player import (
SCAN_INTERVAL as MEDIAPLAYER_SCAN_INTERVAL,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, Platform
from homeassistant.core import HomeAssistant
@ -33,7 +36,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: VlcConfigEntry) -> bool:
port = config[CONF_PORT]
password = config[CONF_PASSWORD]
vlc = Client(password=password, host=host, port=port)
vlc = Client(
password=password,
host=host,
port=port,
timeout=int(MEDIAPLAYER_SCAN_INTERVAL.total_seconds() - 1),
)
available = True