Fix Zone 2 and Zone 3 detection in onkyo (#55471)

This commit is contained in:
Feliksas The Lion 2021-08-31 06:33:52 +03:00 committed by GitHub
parent dd21bf73fc
commit 13b001cd9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -145,16 +145,22 @@ def determine_zones(receiver):
out = {"zone2": False, "zone3": False}
try:
_LOGGER.debug("Checking for zone 2 capability")
receiver.raw("ZPWQSTN")
out["zone2"] = True
response = receiver.raw("ZPWQSTN")
if response != "ZPWN/A": # Zone 2 Available
out["zone2"] = True
else:
_LOGGER.debug("Zone 2 not available")
except ValueError as error:
if str(error) != TIMEOUT_MESSAGE:
raise error
_LOGGER.debug("Zone 2 timed out, assuming no functionality")
try:
_LOGGER.debug("Checking for zone 3 capability")
receiver.raw("PW3QSTN")
out["zone3"] = True
response = receiver.raw("PW3QSTN")
if response != "PW3N/A":
out["zone3"] = True
else:
_LOGGER.debug("Zone 3 not available")
except ValueError as error:
if str(error) != TIMEOUT_MESSAGE:
raise error