# Overview

The Setup Wizard is a build-in feature that guides the user through the initial setup process. This page documents the protocol that underlies the setup wizard functionality.

When a WebSocket connection is first established to the TVH server, an array of unsolicited messages is received.

A message with a `notificationClass` property of type `accessUpdate` should be present in that array.  If there is a  `wizard` property present in that message, it will contain the name of the current wizard step.

This information can also be obtained from `comet/poll/.`\
**Note:** No `/api/` prefix.

#### Wizard Steps

<table><thead><tr><th width="133">Step Name</th><th>Wizard Operation</th></tr></thead><tbody><tr><td>"hello"</td><td>Language selection.</td></tr><tr><td>"login"</td><td>Computer Network, Admin and User details.</td></tr><tr><td>"network"</td><td>TVH Network Type to Adaptor mapping.</td></tr><tr><td>"muxes"</td><td>Pre-defined mux selection, per TVH Network type.</td></tr><tr><td>"status"</td><td>Service scanning. (<a href="#service-scan-progress-tracking">See below</a>)</td></tr><tr><td>"mapping"</td><td>Service Mapping and Tag creation.</td></tr><tr><td>"channels"</td><td>This is the 'Finished' screen.</td></tr></tbody></table>

At each step, there is a corresponding 'load' and 'save' operation.

**For example:**

`/api/wizard/login/load`\
`/api/wizard/login/save`

Each 'load' operation retrieves the fields that are required for that step and the 'save' operation returns the values of those fields.

**Sample response for '/api/wizard/login/save':**

`{`\
&#x20;   `"network":"0.0.0.0/0",`\
&#x20;   `"admin_username":"admin_user",`\
&#x20;   `"admin_password":"admin_password",`\
&#x20;   `"username":"normal_user",`\
&#x20;   `"password":"normal_password",`\
&#x20;   `"uuid":"00000000000000000000000000000000"`\
`}`

#### Manual Operations

The wizard can be manually started with a `/api/wizard/start` operation. This operation resets the 'wizard' property to "hello".

The wizard can be manually stopped with a `/api/wizard/cancel` operation. This operation removes the 'wizard' property.

#### **Service Scan Progress Tracking**

After the muxes are saved, TVH will commence scanning for services.  In order to obtain progress of this scan, TVH should be periodically polled using `/api/wizard/status/progress?_dc=[Unix time stamp].`  TVH will respond with a status message containing the current progress, mux count and discovered service count.  For example:

`{"progress":0,"muxes":6,"services":0}{"progress":0.6666666666666667,"muxes":6,"services":41}{"progress":1,"muxes":6,"services":58}`

Once `progress` reaches `1`, the service scan is complete and the wizard can progress to the next step.

#### **Outstanding Topics**

* Error messages
* Data validation


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tvheadend.org/documentation/setup-wizard-workflow/overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
