'Test arming home via command topic.'

def test_arm_home_via_command_topic(self):

    assert setup_component(self.hass, alarm_control_panel.DOMAIN, {alarm_control_panel.DOMAIN: {'platform': 'manual_mqtt', 'name': 'test', 'pending_time': 1, 'state_topic': 'alarm/state', 'command_topic': 'alarm/command', 'payload_arm_home': 'ARM_HOME'}})
    entity_id = 'alarm_control_panel.test'
    self.assertEqual(STATE_ALARM_DISARMED, self.hass.states.get(entity_id).state)
    fire_mqtt_message(self.hass, 'alarm/command', 'ARM_HOME')
    self.hass.block_till_done()
    self.assertEqual(STATE_ALARM_PENDING, self.hass.states.get(entity_id).state)
    future = (dt_util.utcnow() + timedelta(seconds=1))
    with patch('homeassistant.components.alarm_control_panel.manual_mqtt.dt_util.utcnow', return_value=future):
        fire_time_changed(self.hass, future)
        self.hass.block_till_done()
    self.assertEqual(STATE_ALARM_ARMED_HOME, self.hass.states.get(entity_id).state)
