diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index 30c18953964..0485d82a274 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -607,7 +607,7 @@ class MQTT(object): "with encoding %s", msg.payload, msg.topic, subscription.encoding) - return + continue self.hass.async_run_job(subscription.callback, msg.topic, payload, msg.qos) diff --git a/tests/components/mqtt/test_init.py b/tests/components/mqtt/test_init.py index a1edff8333d..24308bc9a7e 100644 --- a/tests/components/mqtt/test_init.py +++ b/tests/components/mqtt/test_init.py @@ -172,6 +172,17 @@ class TestMQTTCallbacks(unittest.TestCase): "b'\\x9a' on test-topic with encoding utf-8", test_handle.output[0]) + def test_all_subscriptions_run_when_decode_fails(self): + """Test all other subscriptions still run when decode fails for one.""" + mqtt.subscribe(self.hass, 'test-topic', self.record_calls, + encoding='ascii') + mqtt.subscribe(self.hass, 'test-topic', self.record_calls) + + fire_mqtt_message(self.hass, 'test-topic', '°C') + + self.hass.block_till_done() + self.assertEqual(1, len(self.calls)) + def test_subscribe_topic(self): """Test the subscription of a topic.""" unsub = mqtt.subscribe(self.hass, 'test-topic', self.record_calls)