From 7d6033a437de511b82b723b1be74b5c5033209a6 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 22 Jan 2020 13:10:56 -0500 Subject: [PATCH 1/6] avoid crashing if DisplayControl is not supported --- wideq/ac.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wideq/ac.py b/wideq/ac.py index 93ccb6a..790c5f5 100644 --- a/wideq/ac.py +++ b/wideq/ac.py @@ -264,8 +264,11 @@ class ACDevice(Device): def get_light(self): """Get a Boolean indicating whether the display light is on.""" - value = self._get_control('DisplayControl') - return value == '0' # Seems backwards, but isn't. + try: + value = self._get_control('DisplayControl') + return value == '0' # Seems backwards, but isn't. + except FailedRequestError: + return 0 # Device does not support reporting display light status def get_volume(self): """Get the speaker volume level.""" From facd0c09ba0877991a5c7d38ad48db21e64b8497 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 22 Jan 2020 13:26:51 -0500 Subject: [PATCH 2/6] return True if display light status not supported --- wideq/ac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wideq/ac.py b/wideq/ac.py index 790c5f5..b2d6128 100644 --- a/wideq/ac.py +++ b/wideq/ac.py @@ -268,7 +268,7 @@ class ACDevice(Device): value = self._get_control('DisplayControl') return value == '0' # Seems backwards, but isn't. except FailedRequestError: - return 0 # Device does not support reporting display light status + return True # Device does not support reporting display light status (so it must be on) def get_volume(self): """Get the speaker volume level.""" From 547f6661181c293f7fef1ed934fa31eba9b61b02 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 22 Jan 2020 13:31:47 -0500 Subject: [PATCH 3/6] improve comment to addres flake complains --- wideq/ac.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wideq/ac.py b/wideq/ac.py index b2d6128..2966efb 100644 --- a/wideq/ac.py +++ b/wideq/ac.py @@ -268,7 +268,9 @@ class ACDevice(Device): value = self._get_control('DisplayControl') return value == '0' # Seems backwards, but isn't. except FailedRequestError: - return True # Device does not support reporting display light status (so it must be on) + # Device does not support reporting display light status + # Since it's probably not changablem the it must be on + return True def get_volume(self): """Get the speaker volume level.""" From 25479802e864155f55dc97dfe164043a85df79ea Mon Sep 17 00:00:00 2001 From: David Date: Wed, 22 Jan 2020 13:35:35 -0500 Subject: [PATCH 4/6] remove trailing whitespace to address flake report --- wideq/ac.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wideq/ac.py b/wideq/ac.py index 2966efb..093b197 100644 --- a/wideq/ac.py +++ b/wideq/ac.py @@ -269,8 +269,8 @@ class ACDevice(Device): return value == '0' # Seems backwards, but isn't. except FailedRequestError: # Device does not support reporting display light status - # Since it's probably not changablem the it must be on - return True + # Since it's probably not changable the it must be on + return True def get_volume(self): """Get the speaker volume level.""" From 23fbb208537eda78fb37081f1cc7d8a35462497e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Vel=C3=A1squez?= <30375021+dacrypt@users.noreply.github.com> Date: Wed, 22 Jan 2020 16:56:08 -0500 Subject: [PATCH 5/6] Update wideq/ac.py Co-Authored-By: Adrian Sampson --- wideq/ac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wideq/ac.py b/wideq/ac.py index 093b197..effe8ad 100644 --- a/wideq/ac.py +++ b/wideq/ac.py @@ -268,7 +268,7 @@ class ACDevice(Device): value = self._get_control('DisplayControl') return value == '0' # Seems backwards, but isn't. except FailedRequestError: - # Device does not support reporting display light status + # Device does not support reporting display light status. # Since it's probably not changable the it must be on return True From a44f0677e604db832657a799b3549df333906cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Vel=C3=A1squez?= <30375021+dacrypt@users.noreply.github.com> Date: Wed, 22 Jan 2020 16:56:16 -0500 Subject: [PATCH 6/6] Update wideq/ac.py Co-Authored-By: Adrian Sampson --- wideq/ac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wideq/ac.py b/wideq/ac.py index effe8ad..f4ac1af 100644 --- a/wideq/ac.py +++ b/wideq/ac.py @@ -269,7 +269,7 @@ class ACDevice(Device): return value == '0' # Seems backwards, but isn't. except FailedRequestError: # Device does not support reporting display light status. - # Since it's probably not changable the it must be on + # Since it's probably not changeable the it must be on. return True def get_volume(self):