Pair list_devices data to next view

How can I transfer data from device_list to the next window?

1 Like

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

How can I get data from device_list in my custom view on the next screen?

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

The device groups app does that by emitting data in custom events from the view to the driver.

For instance, the “class” template emits an addClass event that contains the device class that the new device group should get.

The driver listens to that event 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, and upon reception, the driver returns the pairingDevice object 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.