# Setup

The first step after [Installation](/cli/installation.md) is to pair your OpenHue CLI with your local Hue Bridge.&#x20;

Configuration can be either done [manually](#the-config-command) or [automatically](#the-setup-command) using the `setup` command.&#x20;

## The `setup` command

The `setup` command allows to automatically discover your Hue Bridge on your local network, waits for you to push the bridge button and finally saves the configuration in your home folder.

<figure><img src="/files/MDaAmPCMoe0L7psJMI2q" alt=""><figcaption><p>Configure OpenHue CLI with the setup command</p></figcaption></figure>

Usage:

```bash
openhue setup
```

Result:

```
[OK] Found Hue Bridge with IP '192.168.1.15'
[..] Please push the button on your Hue Bridge
........
[OK] Successfully paired openhue with your Hue Bridge!
[OK] Configuration saved in file /home/.openhue/config.yaml
```

The setup command also allows the set the bridge IP using the `--bridge` parameter:&#x20;

```bash
openhue setup --bridge 192.168.1.100
```

{% hint style="info" %}
You can also easily discover your Hue Bridge IP address by visiting [discovery.meethue.com](https://discovery.meethue.com)
{% endhint %}

## The `discover` command

The OpenHue CLI provides the `discover` command that allows to easily the IP of your local Hue Bridge using [mDNS Service Discovery](https://en.wikipedia.org/wiki/Multicast_DNS).

Usage:&#x20;

```shell
openhue discover
```

Result:

```
192.168.1.15
```

## The `config` command

The OpenHue CLI allows you to manually configure the application using the `config` command.&#x20;

The Hue Authentication Key required by the `config` command can be obtained via the [Authentication](/api/openhue-api/authentication.md) API.&#x20;

Usage:&#x20;

```bash
openhue config --bridge 192.168.1.15 --key xxx
```

Result:&#x20;

```
[OK] Configuration saved in file /home/.openhue/config.yaml
```

## Manual Configuration

You can still decide to configure the OpenHue CLI completely manually by creating the config file by yourself.&#x20;

OpenHue CLI loads its configuration from a YAML file located in your home directory under the `.openhue` folder.&#x20;

Here are the commands that allows configuring OpenHue CLI manually:&#x20;

```bash
mkdir ~/.openhue
touch ~/.openhue/config.yaml
echo "bridge: {{REPLACE WITH YOUR BRIDGE IP}}" >> ~/.openhue/config.yaml
echo "key: {{REPLACE WITH YOUR KEY}}" >> ~/.openhue/config.yaml
```

## Troubleshooting

When openhue attempts to discover the IP of your bridge using either the [`setup`](#the-setup-command) or [`discover`](#the-discover-command) commands, it is possible your OS might ask you to authorize the application to accept incoming network connections.

For instance on MacOs:&#x20;

<figure><img src="/files/PChFiWnQhaD12wJQpz3V" alt=""><figcaption><p>mDNS Service Discovery message on MacOs</p></figcaption></figure>

We will try to find a solution in the future versions, but for now we will ask you to click on Allow.


---

# 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://www.openhue.io/cli/setup.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.
