async def test_update_with_json_attrs_bad_json(hass, mqtt_mock, caplog):
    'Test attributes get extracted from a JSON result.'
    assert (await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMAIN: {'platform': 'mqtt', 'name': 'test', 'json_attributes_topic': 'attr-topic'}}))
    async_fire_mqtt_message(hass, 'attr-topic', 'This is not JSON')
    state = hass.states.get('vacuum.test')
    assert (state.attributes.get('val') is None)
    assert ('Erroneous JSON: This is not JSON' in caplog.text)
Test attributes get extracted from a JSON result.
async def test_update_with_json_attrs_bad_json(hass, mqtt_mock, caplog):
    
    assert (await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMAIN: {'platform': 'mqtt', 'name': 'test', 'json_attributes_topic': 'attr-topic'}}))
    async_fire_mqtt_message(hass, 'attr-topic', 'This is not JSON')
    state = hass.states.get('vacuum.test')
    assert (state.attributes.get('val') is None)
    assert ('Erroneous JSON: This is not JSON' in caplog.text)