Skip to content

Instantly share code, notes, and snippets.

@iver56
Created April 28, 2025 20:19
Show Gist options
  • Save iver56/5cec0e05c0b996ff7770028bc46047b8 to your computer and use it in GitHub Desktop.
Save iver56/5cec0e05c0b996ff7770028bc46047b8 to your computer and use it in GitHub Desktop.
HomeyScript that checks if the Philips Hue app has a working Hue Bridge connection
// Hue App Status Checker
const HUE_APP_ID = 'nl.philips.hue';
const app = await Homey.apps.getApp({ id: HUE_APP_ID });
const isAppReady = !!app.ready;
if (!isAppReady) {
console.log('App is not ready');
return false;
}
// Grab every device that belongs to the Philips-Hue app
const allDevices = Object.values(await Homey.devices.getDevices());
const hueDevices = allDevices.filter(d => d.driverId?.startsWith(`homey:app:${HUE_APP_ID}`));
console.log(`Found ${hueDevices.length} hue devices`)
// If you don’t own any Hue devices we treat that as “not connected”
if (hueDevices.length === 0) {
console.log('We do not own any hue devices')
return false;
}
// A single unavailable device is enough to signal the bridge is lost
return hueDevices.every(d => d.available);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment