Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ def _mqtt_handle_message(self, msg):
"with encoding %s",
msg.payload, msg.topic,
subscription.encoding)
return
continue

self.hass.async_run_job(subscription.callback,
msg.topic, payload, msg.qos)
Expand Down
11 changes: 11 additions & 0 deletions tests/components/mqtt/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,17 @@ def test_receiving_non_utf8_message_gets_logged(self):
"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)
Expand Down