From c624e50b60e0f08faf42660390e7c707233d295c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 6 May 2023 17:47:15 -0500 Subject: [PATCH] Update onvif error checking to use explict None check (#92642) --- homeassistant/components/onvif/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/onvif/util.py b/homeassistant/components/onvif/util.py index a88a37f5d20..5077a65e0b0 100644 --- a/homeassistant/components/onvif/util.py +++ b/homeassistant/components/onvif/util.py @@ -17,16 +17,16 @@ def stringify_onvif_error(error: Exception) -> str: """Stringify ONVIF error.""" if isinstance(error, Fault): message = error.message - if error.detail: + if error.detail is not None: # checking true is deprecated # Detail may be a bytes object, so we need to convert it to string if isinstance(error.detail, bytes): detail = error.detail.decode("utf-8", "replace") else: detail = str(error.detail) message += ": " + detail - if error.code: + if error.code is not None: # checking true is deprecated message += f" (code:{error.code})" - if error.subcodes: + if error.subcodes is not None: # checking true is deprecated message += ( f" (subcodes:{','.join(extract_subcodes_as_strings(error.subcodes))})" )