# \[RFDriver\] Error when pairing a device

**URL:** <https://community.homey.app/t/rfdriver-error-when-pairing-a-device/88466>\
**Category:** Developers\
**Created:** [August 31, 2023, 12:01pm UTC](https://community.homey.app/t/rfdriver-error-when-pairing-a-device/88466 "2023-08-31T12:01:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin072](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martin072/32/70637_2.png) [@Martin072](https://community.homey.app/u/Martin072)\
**Post date:** [August 31, 2023, 12:01pm UTC](https://community.homey.app/t/rfdriver-error-when-pairing-a-device/88466/1 "2023-08-31T12:01:59Z")

</div>

I am pulling my hairs out. I am a rookie regarding javascript and Homey apps, but I have been working on an app for a 433mhz device. Out of a sudden (or I have broke something), I get this error when trying to pair a remote:

```auto
[err] [MyApp] TypeError: Cannot read properties of undefined (reading 'name')
    at AsyncFunction.listener (/app/node_modules/homey-rfdriver/lib/RFDriver.js:174:25)
    at /app/node_modules/homey-rfdriver/lib/RFSignal.js:120:26
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

```

I can’t recall making any change that caused the paring to fail. I am using the standard `rf-transmitter-learn.html`

when looking at the error, the specific line says:

```auto
await session.emit('createDevice', {
 ---> name: this[sRF].name, <----
        data: {
          uuid: RFUtil.generateUUIDv4(),
          ...signal.constructor.commandToDeviceData(command),
          copiedFromRemote: true,
        },
      });

```

Looking at the object `this[sRF]` it logs as `undefined` so the error make sense, but can’t figure out what is causing it…  
(when changing to: `name: "something", ` it pairs fine.

---

<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:** [August 31, 2023, 12:08pm UTC](https://community.homey.app/t/rfdriver-error-when-pairing-a-device/88466/2 "2023-08-31T12:08:39Z")

</div>

Are you sure you’re using `onRFInit()` on your driver and not `onInit()`?

---

<div class="post-metadata">

**Author:** ![Martin072](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martin072/32/70637_2.png) [@Martin072](https://community.homey.app/u/Martin072)\
**Post date:** [August 31, 2023, 12:09pm UTC](https://community.homey.app/t/rfdriver-error-when-pairing-a-device/88466/3 "2023-08-31T12:09:57Z")

</div>

```auto
async onInit() {
  ...
  ...
}

```

Has been there for weeks, and worked fine before.

Changed it, and works fine again. Thanks!

---

<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:** [August 31, 2023, 12:12pm UTC](https://community.homey.app/t/rfdriver-error-when-pairing-a-device/88466/4 "2023-08-31T12:12:33Z")

</div>

`homey-rfdriver` has last been updated 10 months ago, and overloading `onInit()` will cause your issue. So why it has worked for weeks is a bit of a mystery…

---

<div class="post-metadata">

**Author:** ![Martin072](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martin072/32/70637_2.png) [@Martin072](https://community.homey.app/u/Martin072)\
**Post date:** [August 31, 2023, 12:16pm UTC](https://community.homey.app/t/rfdriver-error-when-pairing-a-device/88466/5 "2023-08-31T12:16:08Z")

</div>

Not sure either, could have been me changing something, lost track 😅

Thanks for the quick response.

Whilst we are here… I noticed when pressing a button on the remote, sometime 2 or even 3 devices are added, is there an easy way to check if a device either already exist -or disregard multiple requests (guess it could be caused by the signal repetitions?)?
