I give up, tried and read my ass off, but it just won’t happen.
Device.id -color, and -capabilities are returned correctly.
But I can’t get the dim value of a light, it returns this error:
dimValue: [object Object]
It has something to do with capabilitiesObj
:
"capabilitiesObj": {
"dim": {
"value": 0.36,
"lastUpdated": "2022-07-01T19:57:53.926Z",
"type": "number",
"getable": true,
"setable": true,
"title": "Dim niveau",
"desc": null,
"units": "%",
"decimals": 2,
"min": 0,
"max": 1,
"chartType": "stepLine",
"id": "dim",
"options": {}
}
}
What is the correct syntax?
Thanks a mil in advance.
.
const devices = await Homey.devices.getDevices();
for (const device of Object.values(devices)) {
if (device.class === 'light') {
if (device.name == "Spot Keuken L") {
// NOT OKAY: dimValue: [object Object]
log("\ndimValue: " + device.capabilitiesObj.dim );
// OK
log(`\nColor: ${device.color}`);
// OK
log(`\nID: ${device.id}`);
// OK
log(`\nCapabilities: ${device.capabilities}`);
}
}
};
return(true);