From 705814cb08a4683a8316170fc5c901ac10ac9135 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 30 Oct 2016 15:17:41 -0700 Subject: [PATCH] Catch all errors when doing mqtt message unicode-decode. (#4143) * catch all errors when doing mqtt message unicode-decode. * added AttributeError and UnicodeDecodeError to exception when decoding an mqtt message payload --- homeassistant/components/mqtt/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index 4595a3c79c4..85d99e5f7ee 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -399,7 +399,7 @@ class MQTT(object): """Message received callback.""" try: payload = msg.payload.decode('utf-8') - except AttributeError: + except (AttributeError, UnicodeDecodeError): _LOGGER.error("Illegal utf-8 unicode payload from " "MQTT topic: %s, Payload: %s", msg.topic, msg.payload)