Hey all,
Is there a way though Homey Script to get all the device settings on board of a device, alter it and re-upload it to a device?
This is what I have so far. I have not ran it yet, since I’m not comfortable running is before getting your feedback
const deviceID = 'ce713301-f469-484c-b444-196c20063dab';
let deviceSettings = await Homey.devices.getDeviceSettingsObj({ id: deviceID })
for (const subSettings of Object.values(deviceSettings)) {
if (subSettings.title === 'Dimming') {
let children = subSettings.children
for (const child of Object.values(children)) {
if (child.id === "maximum_brightness") {
child.value = 50;
}
}
}
}
// write new settings
await Homey.devices.setDeviceSettings({ id: deviceID, settings: deviceSettings })
one command is getDeviceSettingsObj()
Note the object, and the other is setDeviceSettings()
sans the Obj
. Looking at the docs I cannot figure out what the command expects. Or in other words could I brick it when I’m not sending the right format?
Another step back. Are this even the right methods to use to read/write device settings from/to a device?
I’ve got 10+ of the same devices and I’m currently tweaking the settings to get them to a desirable situation. Changing 6 settings of 10 devices a few times a day for a few days is no fun Yes, once the settings are done you don’t need the script anymore. But in the process I also learn about HS. So double win