Hi there,
I try my first widget and configured a settings in the widget.compose.json
as described in the documentation.
...
"settings": [{
"id": "imageServerIp",
"type" : "text",
"title": {"en": "IP Address"},
"value": "http://<ipaddress>/rest/latest",
"hint": "The IP address for the imaging rest api"
}],...
I created a function in the api.js file. This works fine, the function is called. But how do I retrieve the setting in this function?
async getLatestImage({ homey, query }) {
// you can access query parameters like "/?foo=bar" through `query.foo`
// you can access the App instance through homey.app
// const result = await homey.app.getSomething();
// return result;
// perform other logic like mapping result data
const imageServerIp = homey.settings.get("imageServerIp");
var settingsKeys = homey.settings.getKeys();
console.log(`ServerIP: ${settingsKeys}`);
return `${imageServerIp}`;
},
The result in imageServerIp
is always null…
regards,
Christian