2020BAUD_RATE = 9600
2121COMMAND_TIMEOUT = 2.0 # seconds to wait for a response
2222MULTI_RESPONSE_DELAY = 0.3 # seconds to wait for multi-response query results
23- PROBE_TIMEOUT = 0.5 # seconds to wait for each probe attempt
23+ PROBE_TIMEOUT = 0.8 # seconds to wait for each probe attempt
2424CR = b"\r "
2525
2626# Volume range constants (dB)
@@ -526,8 +526,11 @@ async def set_digital_input(self, mode: DigitalInputMode) -> None:
526526 """Set digital input mode."""
527527 await self ._send_command ("SD" , mode .value )
528528
529- async def query_digital_input (self ) -> DigitalInputMode :
530- return DigitalInputMode (await self ._query ("SD" ))
529+ async def query_digital_input (self ) -> DigitalInputMode | None :
530+ param = await self ._query ("SD" )
531+ if param == "NO" :
532+ return None
533+ return DigitalInputMode (param )
531534
532535 # -- Video select commands --
533536
@@ -638,7 +641,9 @@ async def zone3_set_volume(self, db: float) -> None:
638641
639642 # -- Probing --
640643
641- async def probe_sources (self ) -> frozenset [InputSource ]:
644+ async def probe_sources (
645+ self , timeout : float | None = None
646+ ) -> frozenset [InputSource ]:
642647 """Probe which input sources the receiver supports.
643648
644649 Tries setting each input source and checks if the receiver accepts it.
@@ -650,6 +655,9 @@ async def probe_sources(self) -> frozenset[InputSource]:
650655 if not self ._connected :
651656 raise ConnectionError ("Not connected" )
652657
658+ if timeout is None :
659+ timeout = PROBE_TIMEOUT
660+
653661 original = self ._state .input_source
654662 available : set [InputSource ] = set ()
655663
@@ -660,7 +668,7 @@ async def probe_sources(self) -> frozenset[InputSource]:
660668 for source in InputSource :
661669 if source == original :
662670 continue
663- resp = await self ._send_and_wait ("SI" , source .value )
671+ resp = await self ._send_and_wait ("SI" , source .value , timeout = timeout )
664672 if resp == source .value :
665673 available .add (source )
666674
@@ -844,11 +852,15 @@ def _process_message(self, message: str) -> None:
844852 changed = self ._process_ps_param (param )
845853
846854 elif prefix == "SD" :
847- try :
848- self ._state .digital_input = DigitalInputMode ( param )
855+ if param == "NO" :
856+ self ._state .digital_input = None
849857 changed = True
850- except ValueError :
851- _LOGGER .warning ("Unknown digital input mode: %s" , param )
858+ else :
859+ try :
860+ self ._state .digital_input = DigitalInputMode (param )
861+ changed = True
862+ except ValueError :
863+ _LOGGER .warning ("Unknown digital input mode: %s" , param )
852864
853865 elif prefix == "SV" :
854866 if param in ("SOURCE" , "OFF" ):
0 commit comments