// Show updates for all apps installed
let myUpdatesArr = await Homey.apps.getApps().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, b.updateAvailable ? {[b.name]: b.updateAvailable} : '' ), {}));
// timestamp
let SysInfo = await Homey.system.getInfo();
// Extract local time
var localTime = SysInfo.dateHuman.slice(SysInfo.dateHuman.indexOf(' ')+1);
let myAppUpdates = JSON.stringify(myUpdatesArr, null, 1);
//console.log ('Available app updates:' , myAppUpdates);
if ( myAppUpdates === '{}' ) {
return 'No apps available updates';
}
if ( myAppUpdates != '{}' ) {
return 'All apps available updates: \n' + localTime + ' \n' + myAppUpdates;
}
Somehow sometimes apps get auto-update enabled after an update, and I want to be informed about that:
Show apps with auto-update enabled:
// Get list of apps with Auto Update enabled
let myAppUpdateEnabledArr = await Homey.apps.getApps().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, b.autoupdate ? {[b.name]:b.autoupdate} : '' ), {}));
let myAppUpdateEnabled = JSON.stringify(myAppUpdateEnabledArr, null, 2);
// timestamp
let SysInfo = await Homey.system.getInfo();
// Extract local time
var localTime = SysInfo.dateHuman.slice(SysInfo.dateHuman.indexOf(' ')+1);
return 'Apps with Auto Update enabled:\n' + localTime + '\n' + myAppUpdateEnabled;
You only have to copy paste the code into this Homeyscript “Then” card: Run code and return Text-tag, Johan.
No script editing needed.
The script output gets stored into the local tag [Result], which you can use in notification cards:
I always used the VersionChecker app too, but a script might even be better (saves another app); thx @Peter_Kawa!
Only the Update available app doesn’t show all updates: I my case it only return an update for the Sonos app, but not the update for the Eufy Security app, which is reported by the VersionChecker app.
Does it check both stable and test updates? Because Sonos currently has a test-update, Eufy Security only stable updates…
I like to view the app version and it’s permissions, but, to solely show the the app name from the JSON results (that’s the formatting you see), I’ll have to search and try on how to do that.
Thanks @Henk_Renting !
You pay better attention than I do apparently .
It should return test-app versions as well. I just installed the Version-Checker app for comparison
I’ll see what’s wrong here (no clue if I can fix it )
Oh, and I found out how to install the Version Checker app.
I just tried it, while I couldn’t get the windos installer to connect.
(All steps are done in your browser)
In case anyone’s interested about the how:
This part: .replace(/{|}|[|]|"/g,'')
replaces any { or } or [ or ] or " signs with nothing ( '' means: an empty string).
(I can’t get my head around there’s still [] signs left in the result )
An example with words will be clearer:
let text = "Mr Blue has a blue house";
let result = text.replace(/blue/g, 'red');
It does; but it outputs all my apps and whether the currently installed version of my apps are live or test…
So it does not show only the apps for which there is an update…