Homey Community Forum

How do I use custom view and system view together?

app
#1

I’d like to create a view for users to key in ID, password and 2 more information. Once the driver has these informations, I’d like to call the system Device List view to display the list of devices retrieved from API.

In my app.json:
“pair”: [
{
“id”: “connect”
},
{
“id”: “list_devices”,
“template”: “list_devices”,
“navigation”: {
“next”: “add_devices”
}
},
{
“id”: “add_devices”,
“template”: “add_devices”
}
]

The connect view has 4 fields and an apply button (which emit(‘connect’))

In my driver, I suppose do I do

onPair(socket){
socket.on(‘connect’, function( data, callback ) {
//calls API and retrieve and format JSON into devices array

    callback(null, 'devices');
}

}

I tried both socket.showView(‘list_devices’) and socket.emit(‘list_devices’) but I’m still stuck on the connect view. How do I go to the list device view and pass the devices along?

#2

Take a look at https://github.com/jjtbsomhorst/eu.jeroensomhorst.domoticz/tree/beta i’m doing something similar there.

#3

Thanks! Have been combing the appstore to look for examples. Will try this out!
The other part of the app where main API calls happen is already done but stuck here for 2 days figuring out how to pass the information in before calling list device…