For the developers and geeks that want to investigate their Homey’s config.
Run from Homey Developer Tools
I write this to remember what I did but also to inspire others that I know are better JS developer that can do more magic. (and hope they share to inspire!)
WARNING: Be Careful! you can ruïne your config by deleting the wrong objects from there! Only use it if you know what you are doing !
// Get Trigger counts for Flows
Homey.flow.getFlows().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, {[b.name]:b.triggerCount}), {}));
// Get broken flows
// Run and search for the result true
Homey.flow.getFlows().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, {[b.name]:b.broken}), {}));
// Or Get broken flows
// Run and only the broken flows are returned ;-)
Homey.flow.getFlows().then(f => Object.values(f).reduce((r,b)=> Object.assign(r, b.broken ? {[b.name]:b.broken} : ''), {}) );
// Search for disabled flows: by Le_Cactus
Homey.flow.getFlows().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, {[b.name]:b.enabled}), {}));
// Get All installed Apps with versions
Homey.apps.getApps().then(f => Object.values(f).reduce((r,b)=>Object.assign(r,
{[b.name]:b.version}), {}));
// Get Available Updates for Apps in AppStore
Homey.apps.getApps().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, {[b.name]:b.updateAvailable}), {}));
// Get Devices Names and IDs for Towanda
Homey.devices.getDevices().then(f => Object.values(f).reduce((r,b)=>Object.assign(r,{[b.name]:b.id}), {}));
// List Zone names and parent
Homey.zones.getZones().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, {[b.name]:b.parent}), {}));;
// Get list all Apps with Auto Update setting
Homey.apps.getApps().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, {[b.name]:b.autoupdate}), {}));
// Get list Auto Update list disabled
Homey.apps.getApps().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, !b.autoupdate ? {[b.name]:b.autoupdate} : '' ), {}));
// Get list Auto Update list enabled
Homey.apps.getApps().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, b.autoupdate ? {[b.name]:b.autoupdate} : '' ), {}));
// Disable Auto Update on All Apps
Homey.apps.getApps().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, b.autoupdate ? Homey.apps.updateApp( { id : b.id , "app" : { "autoupdate" : false }} ) : {[b.name]:b.autoupdate}), {}));
// Disable All Apps
// Homey.apps.getApps().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, b.enabled ? Homey.apps.disableApp( { id : b.id} ) : {[b.name]:b.enabled}), {}));
// Enable All Apps
Homey.apps.getApps().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, !b.enabled ? Homey.apps.enableApp( { id : b.id} ) : {[b.name]:b.enabled}), {}));
// Some ZigBee Queries Online devices:
// online receiveWhenIdle name modelId type
Homey.zigBee.getState().then(f => Object.values(f.nodes).reduce((r,b)=> Object.assign(r, b.online ? {[b.name]:b.type} : ''), {}) );
// receiveWhenIdle => name
Homey.zigBee.getState().then(f => Object.values(f.nodes).reduce((r,b)=> Object.assign(r, b.receiveWhenIdle ? {[b.name]:b.type} : ''), {}) );
// receiveWhenIdle => modelId
Homey.zigBee.getState().then(f => Object.values(f.nodes).reduce((r,b)=> Object.assign(r, b.receiveWhenIdle ? {[b.modelId ]:b.type} : ''), {}) );