> For the complete documentation index, see [llms.txt](https://apps.developer.homey.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apps.developer.homey.app/the-basics/devices/pairing/system-views/pincode.md).

# Pincode

**Usage:** `"template": "pincode"`

<figure><img src="/files/uyQ6uQkfzcgThf33chf2" alt=""><figcaption></figcaption></figure>

{% code title="/drivers/\<driver\_id>/driver.compose.json" %}

```javascript
{
  "name": { "en": "My Driver" },
  "images": {
    "small": "/drivers/my_driver/assets/images/small.png",
    "large": "/drivers/my_driver/assets/images/large.png"
  },
  "pair": [
    {
      "id": "list_devices",
      "template": "list_devices",
      "navigation": { "next": "pincode" }
    },
    {
      "id": "pincode",
      "template": "pincode",
      "options": {
        "title": "Login with your account",
        "hint": "Enter the device's pincode",
        "type": "number",
        "length": 4
      }
    },
    {
      "id": "add_devices",
      "template": "add_devices"
    }
  ]
}
```

{% endcode %}

## **Options**

| Key      | Type                                                          | Default            | Description                                                                                                                |
| -------- | ------------------------------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| `type`   | `string`                                                      | `"number"`         | Either `number` or `text`. This changes how the keyboard is presented on mobile phones when the pincode field is selected. |
| `length` | `number`                                                      | `4`                | The number of characters                                                                                                   |
| `hint`   | [translation object](/the-basics/app/internationalization.md) | `""`               |                                                                                                                            |
| `title`  | [translation object](/the-basics/app/internationalization.md) | `"Enter pincode:"` |                                                                                                                            |

{% tabs %}
{% tab title="JavaScript" %}
{% code title="/drivers/\<driver\_id>/driver.js" %}

```javascript
const Homey = require("homey");

class Driver extends Homey.Driver {
  onPair(session) {
    session.setHandler("pincode", async (pincode) => {
      // The pincode is given as an array of the filled in values
      return (
        pincode[0] === "1"
        && pincode[1] === "2" 
        && pincode[2] === "3"
        && pincode[3] === "4"
      );
    });
  }
}

module.exports = Driver;
```

{% endcode %}
{% endtab %}

{% tab title="TypeScript" %}
{% code title="/drivers/\<driver\_id>/driver.mts" %}

```mts
import Homey from "homey";

export default class Driver extends Homey.Driver {
  async onPair(session: Homey.Driver.PairSession): Promise<void> {
    session.setHandler("pincode", async (pincode: string[]): Promise<boolean> => {
      // The pincode is given as an array of the filled in values
      return (
        pincode[0] === "1"
        && pincode[1] === "2"
        && pincode[2] === "3"
        && pincode[3] === "4"
      );
    });
  }
}

```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code title="/drivers/\<driver\_id>/driver.py" %}

```python
from homey import driver
from homey.pair_session import PairSession


class Driver(driver.Driver):
    async def on_pair(self, session: PairSession) -> None:
        async def on_pincode(pincode: list[str]) -> bool:
            # The pincode is given as an array of the filled in values
            return (
                pincode[0] == "1"
                and pincode[1] == "2"
                and pincode[2] == "3"
                and pincode[3] == "4"
            )


homey_export = Driver

```

{% endcode %}
{% endtab %}
{% endtabs %}
