# Custom pairing to configure device IP address

**URL:** <https://community.homey.app/t/custom-pairing-to-configure-device-ip-address/73920>\
**Category:** Developers\
**Tags:** devices\
**Created:** [December 21, 2022, 8:04am UTC](https://community.homey.app/t/custom-pairing-to-configure-device-ip-address/73920 "2022-12-21T08:04:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![OH2TH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/oh2th/32/111414_2.png) [@OH2TH](https://community.homey.app/u/OH2TH)\
**Post date:** [December 21, 2022, 8:04am UTC](https://community.homey.app/t/custom-pairing-to-configure-device-ip-address/73920/1 "2022-12-21T08:04:49Z")

</div>

Some how I am not getting Custom Pairing to work following the instructions by Homey:

> **[Custom Pairing Views](https://apps.developer.homey.app/advanced/custom-views/custom-pairing-views#emit-an-event)**
>
> Most drivers will suffice using the provided pairing templates. Some advanced drivers however can benefit from creating their own views.

driver.compose.json has:

```auto
  "pair": [
    {
      "id": "manual_pairing"
    }
  ]

```

and that triggers correctly pair/manual\_pairing.html from the driver and it has:

```auto
      Homey.emit('manual_pairing', { address: address }).then(function (result) {
        console.log('Manual pairing returned:', result);

      });

```

where `address` is collected by a form input successfully. The form has a button that triggers the function where above Homey.emit is.  
That calls successfully `manual_pairing` handler as defined:

```auto
   session.setHandler('manual_pairing', async function (data) {
      try {
        console.log('manual_pairing: ', data.address);
        const api = new GoeChargerApi();
        api.address = data.address;
        const initialInfo = await api.getInitialInfo();
        initialInfo.address = data.address;
        console.log('manual_pairing result: ', initialInfo);
        return {
          name: initialInfo.name,
          data: {
            id: initialInfo.id,
          },
          settings: {
            address: initialInfo.address,
          },
          store: {}
        }
      } catch (e) {
        console.log(e);
        throw new Error(this.homey.__('pair.error'));
      }
    });

```

as is evidenced in console I do receive the two outputs:

```auto
manual_pairing: 192.168.4.16
manual_pairing result: { id: '000000', name: 'go-eCharger 000000', address: '192.168.4.16' }

```

This is where I seem to fail on returning the device definition back to frontend manual\_pairing.html, it should now output to `console.log('Manual pairing returned:', result);`, but nothing happens.

Next I would want the returned device definition to be used to add the device as defined. But since I can’t get the thing to even respond with the result, how can I get it to do something with the result.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [December 21, 2022, 10:36am UTC](https://community.homey.app/t/custom-pairing-to-configure-device-ip-address/73920/2 "2022-12-21T10:36:43Z")

</div>

Looks okay to me, and similar code is working just fine for me.

Assuming that there are no errors being thrown (you’re not dealing with those in the frontend code, but I’m pretty sure they will end up in your browser’s dev console) it might be caused by something not shown in your code snippet.

---

<div class="post-metadata">

**Author:** ![OH2TH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/oh2th/32/111414_2.png) [@OH2TH](https://community.homey.app/u/OH2TH)\
**Post date:** [December 21, 2022, 2:25pm UTC](https://community.homey.app/t/custom-pairing-to-configure-device-ip-address/73920/3 "2022-12-21T14:25:46Z")

</div>

But of course, browser dev tools console, and there it is. How silly of me.  
Next to figure out how to send that to the next view for user to verify the found device before adding it.

---

<div class="post-metadata">

**Author:** ![OH2TH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/oh2th/32/111414_2.png) [@OH2TH](https://community.homey.app/u/OH2TH)\
**Post date:** [December 21, 2022, 5:04pm UTC](https://community.homey.app/t/custom-pairing-to-configure-device-ip-address/73920/4 "2022-12-21T17:04:32Z")

</div>

Replying to myself.

manual\_pairing and add\_device are now working properly with IP address configuration custom view.  
Now I can go back to device.js and fix the addressing logic.

Thanks @robertklep for pointing to dev console of the browser, I had completely forgot it.
