From 2dcd9d94c8e80347b81ebfd07ea8d25ae1f43ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isabella=20Gross=20Alstr=C3=B6m?= Date: Wed, 13 Mar 2019 21:00:08 +0100 Subject: [PATCH] Allow all success status codes in REST notify response (#22011) For example Discord webhooks returns a 204 success code as response, which gets logged as an error in the log, even though it is successful. Update the allowed statuses to accept all 2xx responses as successful. --- homeassistant/components/notify/rest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/notify/rest.py b/homeassistant/components/notify/rest.py index 710a1a597e9..df25045c6ec 100644 --- a/homeassistant/components/notify/rest.py +++ b/homeassistant/components/notify/rest.py @@ -112,7 +112,8 @@ class RestNotificationService(BaseNotificationService): response = requests.get(self._resource, headers=self._headers, params=data, timeout=10) - if response.status_code not in (200, 201, 202): + success_codes = (200, 201, 202, 203, 204, 205, 206, 207, 208, 226) + if response.status_code not in success_codes: _LOGGER.exception( "Error sending message. Response %d: %s:", response.status_code, response.reason)