async def test_discovery_update_vacuum(hass, mqtt_mock):
    'Test update of discovered vacuum.'
    entry = MockConfigEntry(domain=mqtt.DOMAIN)
    (await async_start(hass, 'homeassistant', {}, entry))
    data1 = '{ "name": "Beer",  "command_topic": "test_topic"}'
    data2 = '{ "name": "Milk",  "command_topic": "test_topic"}'
    async_fire_mqtt_message(hass, 'homeassistant/vacuum/bla/config', data1)
    (await hass.async_block_till_done())
    state = hass.states.get('vacuum.beer')
    assert (state is not None)
    assert (state.name == 'Beer')
    async_fire_mqtt_message(hass, 'homeassistant/vacuum/bla/config', data2)
    (await hass.async_block_till_done())
    state = hass.states.get('vacuum.beer')
    assert (state is not None)
    assert (state.name == 'Milk')
    state = hass.states.get('vacuum.milk')
    assert (state is None)
Test update of discovered vacuum.
async def test_discovery_update_vacuum(hass, mqtt_mock):
    
    entry = MockConfigEntry(domain=mqtt.DOMAIN)
    (await async_start(hass, 'homeassistant', {}, entry))
    data1 = '{ "name": "Beer",  "command_topic": "test_topic"}'
    data2 = '{ "name": "Milk",  "command_topic": "test_topic"}'
    async_fire_mqtt_message(hass, 'homeassistant/vacuum/bla/config', data1)
    (await hass.async_block_till_done())
    state = hass.states.get('vacuum.beer')
    assert (state is not None)
    assert (state.name == 'Beer')
    async_fire_mqtt_message(hass, 'homeassistant/vacuum/bla/config', data2)
    (await hass.async_block_till_done())
    state = hass.states.get('vacuum.beer')
    assert (state is not None)
    assert (state.name == 'Milk')
    state = hass.states.get('vacuum.milk')
    assert (state is None)