# Pair list\_devices data to next view

**URL:** <https://community.homey.app/t/pair-list-devices-data-to-next-view/2276>\
**Category:** Developers\
**Tags:** app\
**Created:** [September 30, 2018, 11:57am UTC](https://community.homey.app/t/pair-list-devices-data-to-next-view/2276 "2018-09-30T11:57:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maxmudjon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/maxmudjon/32/1163_2.png) [@Maxmudjon](https://community.homey.app/u/Maxmudjon)\
**Post date:** [September 30, 2018, 11:57am UTC](https://community.homey.app/t/pair-list-devices-data-to-next-view/2276/1 "2018-09-30T11:57:25Z")

</div>

How can I transfer data from device\_list to the next window?

---

<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:** [October 2, 2018, 8:15am UTC](https://community.homey.app/t/pair-list-devices-data-to-next-view/2276/2 "2018-10-02T08:15:33Z")

</div>

In your driver, either call the callback with the list of devices (if you’re using `onPairListDevices`), or emit an event `list_device` with the list of devices (if you’re using `onPair`).

Documented here: [https://developer.athom.com/docs/apps/tutorial-Drivers-Pairing-System%20Views-Devices%20List.html](https://developer.athom.com/docs/apps/tutorial-Drivers-Pairing-System%20Views-Devices%20List.html)

---

<div class="post-metadata">

**Author:** ![Maxmudjon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/maxmudjon/32/1163_2.png) [@Maxmudjon](https://community.homey.app/u/Maxmudjon)\
**Post date:** [October 11, 2018, 10:00am UTC](https://community.homey.app/t/pair-list-devices-data-to-next-view/2276/3 "2018-10-11T10:00:43Z")

</div>

How can I get data from device\_list in my custom view on the next screen?

---

<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:** [October 11, 2018, 10:31am UTC](https://community.homey.app/t/pair-list-devices-data-to-next-view/2276/4 "2018-10-11T10:31:08Z")

</div>

Perhaps you need to be a bit more clear on what exactly it is that you want to do.

---

<div class="post-metadata">

**Author:** ![Maxmudjon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/maxmudjon/32/1163_2.png) [@Maxmudjon](https://community.homey.app/u/Maxmudjon)\
**Post date:** [October 11, 2018, 11:21am UTC](https://community.homey.app/t/pair-list-devices-data-to-next-view/2276/5 "2018-10-11T11:21:02Z")

</div>

![%D0%91%D0%B5%D0%B7%20%D0%B8%D0%BC%D0%B5%D0%BD%D0%B8-1](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/d/d0522b10a218d03ad89882426cd538782bab232c.jpeg)

---

<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:** [October 11, 2018, 11:42am UTC](https://community.homey.app/t/pair-list-devices-data-to-next-view/2276/6 "2018-10-11T11:42:05Z")

</div>

The [device groups app](https://github.com/swttt/com.swttt.devicegroups/tree/master/drivers/devicegroup/pair) does that by emitting data in custom events from the view to the driver.

For instance, the [“class” template emits an `addClass` event](https://github.com/swttt/com.swttt.devicegroups/blob/3e58128209e1036c5509b5ff6de5296e4addce33/drivers/devicegroup/pair/class.html#L12) that contains the device class that the new device group should get.

The driver [listens to that event](https://github.com/swttt/com.swttt.devicegroups/blob/3e58128209e1036c5509b5ff6de5296e4addce33/drivers/devicegroup/driver.js#L19) and stores it in the `pairingDevice` object which will eventually contain all data for the new device.

The next template, “capabilities”, [emits the `startedCapabilities` event](https://github.com/swttt/com.swttt.devicegroups/blob/3e58128209e1036c5509b5ff6de5296e4addce33/drivers/devicegroup/pair/capabilities.html#L6), and upon reception, the [driver returns the `pairingDevice` object](https://github.com/swttt/com.swttt.devicegroups/blob/3e58128209e1036c5509b5ff6de5296e4addce33/drivers/devicegroup/driver.js#L24) that includes the device class that was set in the previous template.

So in other words: a view template sends the data to the driver, the driver stores it somewhere, and the next view template asks the driver to send the stored data back to it.
