# 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:** 1\
**Showing post:** 6

<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.

---

_[View the full topic](https://community.homey.app/t/pair-list-devices-data-to-next-view/2276)._
