# init – connect

> Establishes the connection to an Accordion station — run this first, before the other commands.

_Source: E-Sharp (esharp.se) · Accordion Shell (CLI)_


## Description

The `init` command establishes a connection to an Accordion hardware device. This is typically the first command you run before performing any hardware operations.

## Syntax

```bash
init --host <hostname_or_ip> [options]
```

## Required Options

| Option | Short | Description |
| --- | --- | --- |
| `--host` | `-h` | The hostname or IP address of the Accordion hardware to connect to |

## Optional Options

| Option | Short | Description | Default |
| --- | --- | --- | --- |
| `--notification` | `-n` | Enable notification event reception | `false` |
| `--telemetry` | `-t` | Enable telemetry event reception | `false` |

## Examples

### Basic Connection

```bash
init --host 192.168.1.100
```

### Connection with Notifications

```bash
init --host accordion-dev-01 --notification
```

### Connection with Telemetry

```bash
init --host 192.168.1.100 --telemetry
```

### Connection with Both Events

```bash
init -h 192.168.1.100 -n -t
```

## Behavior

1. Establishes connection to the specified host
2. Calls WebApiState.Connect() with the host URL
3. Retrieves connection status from the API
4. Warns if host responds but reports not connected
5. Reports success message
6. If notification or telemetry flags are used, displays a notice that they are not supported in WebApi mode

## Output

Success message:

```
Connecting to http://192.168.1.100...
Connected to http://192.168.1.100
```

With notifications/telemetry requested:

```
Connecting to http://192.168.1.100...
Connected to http://192.168.1.100
  → Notifications requested but not supported in WebApi mode
  → Telemetry requested but not supported in WebApi mode
```

## Event Handlers

The `--notification` and `--telemetry` flags are accepted but not currently supported in WebApi mode. A dim-coloured notice is displayed when they are used. The flags exist for compatibility but have no effect in the current WebApi client.

## Notes

- You must initialize a connection before using most other commands
- Only one connection can be active at a time
- Connection state persists in interactive mode
- Use this command first in batch scripts

## Error Handling

- **Host not found**: Check hostname/IP address
- **Connection refused**: Verify the Accordion service is running
- **Timeout**: Check network connectivity and firewall settings
