async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock):
    'Test the setting of attribute via MQTT with JSON payload.'
    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', '{ "val": "100" }')
    state = hass.states.get('vacuum.test')
    assert (state.attributes.get('val') == '100')
Test the setting of attribute via MQTT with JSON payload.
async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock):
    
    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', '{ "val": "100" }')
    state = hass.states.get('vacuum.test')
    assert (state.attributes.get('val') == '100')