1 """Code to handle a DenonAVR receiver."""
3 from __future__
import annotations
5 from collections.abc
import Callable
9 from denonavr
import DenonAVR
10 from denonavr.exceptions
import AvrProcessingError
13 _LOGGER = logging.getLogger(__name__)
17 """Class to async connect to a DenonAVR receiver."""
23 show_all_inputs: bool,
27 update_audyssey: bool,
28 async_client_getter: Callable[[], httpx.AsyncClient],
30 """Initialize the class."""
32 self.
_receiver_receiver: DenonAVR |
None =
None
39 self._zones: dict[str, str |
None] = {}
41 self._zones[
"Zone2"] =
None
43 self._zones[
"Zone3"] =
None
47 """Return the class containing all connections to the receiver."""
51 """Connect to the DenonAVR receiver."""
56 self.
_receiver_receiver.manufacturer
is None
58 or self.
_receiver_receiver.model_name
is None
59 or self.
_receiver_receiver.receiver_type
is None
63 "Missing receiver information: manufacturer '%s', name '%s', model"
74 "%s receiver %s at host %s connected, model %s, serial %s, type %s",
86 """Initialize the DenonAVR class asynchronously."""
91 add_zones=self._zones,
95 await receiver.async_setup()
98 for zone
in receiver.zones.values():
99 with contextlib.suppress(AvrProcessingError):
100 await zone.async_update()
102 await zone.async_update_audyssey()
103 await receiver.async_telnet_connect()
bool async_connect_receiver(self)
None __init__(self, str host, float timeout, bool show_all_inputs, bool zone2, bool zone3, bool use_telnet, bool update_audyssey, Callable[[], httpx.AsyncClient] async_client_getter)
DenonAVR|None receiver(self)
None async_init_receiver_class(self)