@Peter_Kawa Thank you for sharing this.
I will give it a try.
For just device + ID overview use this code in HomeyScript:
const devices = await Homey.devices.getDevices();
console.log(`\nDevices overview`);
// Loop over all devices
for (const device of Object.values(devices)) {
// Return some properties. Just remove what you don't need
console.log(`\nName:\t\t ${device.name} \nID:\t\t ${device.id} `);
};
return(true);
Tank you.
But when i try it in Homey at the Developers Tools i get this error.
Response
ârootâ:{
1 item
âerrorâ:
string"await is only valid in async functions and the top level bodies of modules"
}
Or is this schript for the Homey app.
Oh, my bad it wasnât clear: this is Homeyscript.
Create a new script
(@ my.homey.app hit the </>
icon on the left, look for + New Homeyscript
below all other scripts)
copy/paste the code,
save and run.
@Peter_Kawa
Thank you.
It works good.
Thanks @martijnpoppen - I donât know why that isnât a native function that is built into the Homey UI
Youâre welcome @K_S !
Wow this scripts is great! Should be applied basic to homey i think
Thanks for making this!
Thanks Martijn!
Today I re-added my Shelly devices using the new generic driver. Something that had to be done sooner or later. Thanks to your script, repairing my flows cost me so much less time.
Thanks, @martijnpoppen, enjoy the beer I bought you!
Thank you so much @Henk_Renting !
Is it possible to adjust the above code that I can only search for 1 specific device name? I have so many devices (150+) that creating this list and then copy/past hangs the browser for minutes.
@M_a_r_c_o yeah I can add a script for that.
Alternative
@Peter_Kawa thats a good suggestion
I got this HomeyScript as well
// Replace MyDevice with the desired device name
let deviceName = "MyDevice"
const myDevices = await Homey.devices.getDevices()
for (var iMyDevice in myDevices){
if (myDevices[iMyDevice].name == deviceName) {
log(`Device:\t ${myDevices[iMyDevice].name} \nZone:\t ${myDevices[iMyDevice].zoneName} \nType:\t ${myDevices[iMyDevice].type} \nValue:\t ${myDevices[iMyDevice].value} \nID:\t ${myDevices[iMyDevice].id}`)
}
}
Sorry, HomeyScript I donât use and do not want to activate it, I already are against memory limits in the Homey Pro (1GB RAM) version). Starting HomeyScript for only this, disrupt performance in my Homey.
Device search is maybe the option, but if we can replace a device id in a web dev tools script, whats the difficulty to search on device name in dev tools? (I am not a programmer, otherwiseâŚ).
I have send a pm (I think) earlier.
@M_a_r_c_o
Yes saw the PM. I thought the suggestion for the device search was a good one. But i can still add a web api console script.
Will do end this week
@M_a_r_c_o added the script to search based on device name. Added to the first message in this topic, but will link it here too: Fix flows by device name
TIP: Make sure to use unique device names. If you have duplicate names it might brick your flows.
And many thanks for your donation! Appreciated!