async def test_all_commands(hass, mqtt_mock):
    'Test simple commands send to the vacuum.'
    config = deepcopy(DEFAULT_CONFIG)
    config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(mqttvacuum.ALL_SERVICES, SERVICE_TO_STRING)
    assert (await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMAIN: config}))
    (await hass.services.async_call(DOMAIN, SERVICE_START, {'entity_id': ENTITY_MATCH_ALL}, blocking=True))
    mqtt_mock.async_publish.assert_called_once_with(COMMAND_TOPIC, 'start', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await hass.services.async_call(DOMAIN, SERVICE_STOP, {'entity_id': ENTITY_MATCH_ALL}, blocking=True))
    mqtt_mock.async_publish.assert_called_once_with(COMMAND_TOPIC, 'stop', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await hass.services.async_call(DOMAIN, SERVICE_PAUSE, {'entity_id': ENTITY_MATCH_ALL}, blocking=True))
    mqtt_mock.async_publish.assert_called_once_with(COMMAND_TOPIC, 'pause', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await hass.services.async_call(DOMAIN, SERVICE_LOCATE, {'entity_id': ENTITY_MATCH_ALL}, blocking=True))
    mqtt_mock.async_publish.assert_called_once_with(COMMAND_TOPIC, 'locate', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await hass.services.async_call(DOMAIN, SERVICE_CLEAN_SPOT, {'entity_id': ENTITY_MATCH_ALL}, blocking=True))
    mqtt_mock.async_publish.assert_called_once_with(COMMAND_TOPIC, 'clean_spot', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await hass.services.async_call(DOMAIN, SERVICE_RETURN_TO_BASE, {'entity_id': ENTITY_MATCH_ALL}, blocking=True))
    mqtt_mock.async_publish.assert_called_once_with(COMMAND_TOPIC, 'return_to_base', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await common.async_set_fan_speed(hass, 'medium', 'vacuum.mqtttest'))
    mqtt_mock.async_publish.assert_called_once_with('vacuum/set_fan_speed', 'medium', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await common.async_send_command(hass, '44 FE 93', entity_id='vacuum.mqtttest'))
    mqtt_mock.async_publish.assert_called_once_with('vacuum/send_command', '44 FE 93', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await common.async_send_command(hass, '44 FE 93', {'key': 'value'}, entity_id='vacuum.mqtttest'))
    assert (json.loads(mqtt_mock.async_publish.mock_calls[(- 1)][1][1]) == {'command': '44 FE 93', 'key': 'value'})
Test simple commands send to the vacuum.
async def test_all_commands(hass, mqtt_mock):
    
    config = deepcopy(DEFAULT_CONFIG)
    config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(mqttvacuum.ALL_SERVICES, SERVICE_TO_STRING)
    assert (await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMAIN: config}))
    (await hass.services.async_call(DOMAIN, SERVICE_START, {'entity_id': ENTITY_MATCH_ALL}, blocking=True))
    mqtt_mock.async_publish.assert_called_once_with(COMMAND_TOPIC, 'start', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await hass.services.async_call(DOMAIN, SERVICE_STOP, {'entity_id': ENTITY_MATCH_ALL}, blocking=True))
    mqtt_mock.async_publish.assert_called_once_with(COMMAND_TOPIC, 'stop', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await hass.services.async_call(DOMAIN, SERVICE_PAUSE, {'entity_id': ENTITY_MATCH_ALL}, blocking=True))
    mqtt_mock.async_publish.assert_called_once_with(COMMAND_TOPIC, 'pause', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await hass.services.async_call(DOMAIN, SERVICE_LOCATE, {'entity_id': ENTITY_MATCH_ALL}, blocking=True))
    mqtt_mock.async_publish.assert_called_once_with(COMMAND_TOPIC, 'locate', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await hass.services.async_call(DOMAIN, SERVICE_CLEAN_SPOT, {'entity_id': ENTITY_MATCH_ALL}, blocking=True))
    mqtt_mock.async_publish.assert_called_once_with(COMMAND_TOPIC, 'clean_spot', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await hass.services.async_call(DOMAIN, SERVICE_RETURN_TO_BASE, {'entity_id': ENTITY_MATCH_ALL}, blocking=True))
    mqtt_mock.async_publish.assert_called_once_with(COMMAND_TOPIC, 'return_to_base', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await common.async_set_fan_speed(hass, 'medium', 'vacuum.mqtttest'))
    mqtt_mock.async_publish.assert_called_once_with('vacuum/set_fan_speed', 'medium', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await common.async_send_command(hass, '44 FE 93', entity_id='vacuum.mqtttest'))
    mqtt_mock.async_publish.assert_called_once_with('vacuum/send_command', '44 FE 93', 0, False)
    mqtt_mock.async_publish.reset_mock()
    (await common.async_send_command(hass, '44 FE 93', {'key': 'value'}, entity_id='vacuum.mqtttest'))
    assert (json.loads(mqtt_mock.async_publish.mock_calls[(- 1)][1][1]) == {'command': '44 FE 93', 'key': 'value'})