Hello everyone,
I am developing an app where the user can select/set the TV channel by picking it from a list. I figured the list should be a custom capability of type enum, however, it requires me to set the values in the app.json. I do not want this, as the values should be the TV channels coming from the tv’s API.
// app.json
...
"capabilities": {
"channel_set": {
"type": "enum",
"title": {
"en": "Channel"
},
"uiComponent": "picker",
"getable": true,
"setable": true,
"values": [{
"id": "empty",
"title": {
"en": "Empty"
}
}],
"icon": "/assets/icon.svg"
}
},
drivers: [
...
"capabilities": [
...
"channel_set"
],
]
This shows a picker with only 1 value, ‘Empty’. This is good, so far, now I want to change the picker values. So what I tried, when the TV connects (device.js), gather the list from the API and map it correctly.
// device.js
... // TV connects here
const channelList = [
{
id: 'some_id',
title: {
en: "Some Title"
}
}
]
this.setCapabilityOptions('channel_set', {values: channelList}).then(() => {
this.log('Finished setting list'); // THIS IS CALLED, SO I EXPECT AN UPDATED PICKER
}, (error) => {
this.error(error)
});
This however does not seem to do anything.
The picker in the app still has the values declared in the app.json instead of what is set in the device.js. Any help or pointers are welcome.