// ===================================================================== // Homey Overview — v1.7.0 // Builds a full system overview (apps, flows, devices, Z-Wave, Zigbee, // logic variables, HomeyScript scripts, backup/storage/memory health, // moods, alarms, and more) and emails it as HTML, with a "Summary & // Actions" section highlighting what changed since the last run. // See the README for setup instructions. // ===================================================================== // Set any of these from `false;` to `true;` to see the corresponding Name(s) or Node ID('s) added to the list. // (See further down for the DEFAULT_MAIL_TO, TIMEZONE and onlyShowDetailsOnChange settings, which you'll likely want to change.) const showUpdateableApps = true; const showDisabledApps = true; // Also covers crashed apps const showSDKv2Apps = true; const showSDKv3Apps = true; const showAppChannels = true; // Show apps broken down by channel: Test (beta) and Development (sideloaded) const showStableApps = true; // Show names of Stable-channel apps (the majority — everything not Test/Development) const showDisabledFlows = true; const showBrokenFlows = true; const showDisabledAdvancedFlows = true; const showBrokenAdvancedFlows = true; const showZwaveDevices = true; const showZwaveRouterDevices = true; const showZwaveUnsecureDevices = true; const showZwaveSecureS0Devices = true; const showZwaveSecureS2AuthenticatedDevices = true; const showZwaveSecureS2UnauthenticatedDevices = true; const showZwaveBatteryDevices = true; const showZwaveUnreachableNodes = true; const showZwaveUnknownNodes = true; const showZigbeeNodes = true; const showZigbeeRouter = true; const showZigbeeEndDevice = true; const showZigbeeUnknownDevices = true; // Annotates each Zigbee node of unclassified/unknown type directly in the "All Zigbee nodes" list (e.g. "Name (unknown type)") instead of a separate section. const showZigbeeStaleNodes = true; // Show names of Zigbee nodes that haven't reported in over zigbeeStaleDays (see below) const showVirtualDevices = true; const showIRDevices = true; const showOtherDevices = true; const showGroupDevices = true; // Show composition of group devices (Homey Pro models post-2022 only) const showLowBatteryDevices = true; // Show names of devices at or below lowBatteryWarningPercent (see below) const showLogicVariables = true; // Show names of Logic variables const showHomeyScriptScripts = true; // Show names of HomeyScript scripts const showExampleScripts = false; // Include Homey's built-in "example-xxx" HomeyScript scripts (shipped with every Homey) in the count/list above. Off by default since they're just Homey's own boilerplate, not something you added. const showBetterLogicVariables = true; // Show names of Better Logic variables (only relevant if that app is installed) // Set any of these to see the corresponding system-health info. Backup, // storage, throttling/under-voltage and images are only available on // Homey Pro models from 2023 onward (post-2022) — the Pro Mini and later // share the same platform/firmware here, so this isn't really a "2023" // distinction. They're silently skipped (shown as "-") on older Homey Pro // models, so it's safe to leave these on regardless of your hardware. // (Homey Self-Hosted likely uses the same platform check, but this hasn't // been independently verified — feedback welcome.) const showBackup = true; // Show date/time of the last successful backup const showStorage = true; // Show used/free storage const showMemory = true; // Show used/free memory const showThrottle = true; // Show throttling & under-voltage status const showImages = true; // Show amount of images const showMoods = true; // Show amount (and names) of Moods — safe to leave on even if you don't use Moods at all, it'll just show 0 const showAlarms = true; // Show amount of alarm clocks // Email settings // Reads the destination address(es) from the flow argument (args[0]), so this // script can be shared/reused without hardcoding a personal email address. // Multiple recipients can be supplied, separated by "," or ";" — one email // is sent per recipient (rather than relying on the mail app to support a // combined recipient list in a single field). // Falls back to a default when run manually from the script editor (no args). const DEFAULT_MAIL_TO = 'your.email@example.com'; // <-- CHANGE THIS to your own email address (only used when run manually without an argument) const rawMailTo = (args && args[0] && String(args[0]).trim()) ? String(args[0]).trim() : DEFAULT_MAIL_TO; const mailToList = rawMailTo.split(/[,;]+/).map(s => s.trim()).filter(Boolean); // Optional: also send a short, plain-text version of the Summary & Actions // section to WhatsApp, on every run, in addition to the HTML email above. // Uses the community CallMeBot app (com.gruijter.callmebot) — install it // from the App Store and add a WhatsApp device there first (you'll need a // CallMeBot API key for that; see the app's own setup for how to get one). // The device's phone number and API key live in THAT device's settings in // Homey, not in this script, so nothing sensitive needs to be hardcoded // here. This script finds your CallMeBot WhatsApp device automatically (by // its driver, regardless of what you named it) and calls its own "Send a // message" flow action — same pattern as the email send further down. See // the README for setup steps. const sendWhatsAppSummary = false; // Set to true to enable (after installing the CallMeBot app and adding a WhatsApp device — see README) // Timezone used to format the date/time shown in the email (subject + header, // and the "last backup" date). The HomeyScript sandbox's default timezone can // be UTC regardless of where your Homey is actually located, so this is set // explicitly rather than left to the system default. CHANGE THIS to your own // IANA timezone name (e.g. 'America/New_York', 'Europe/London', 'Asia/Tokyo') // if you're not in the Netherlands. const TIMEZONE = 'Europe/Amsterdam'; // false (default) = always include the full detail report (System, Apps, // Flows, Devices, etc.) below the Summary. // true = only include the detail report when the Summary actually found // something (a change or an issue) — on a "nothing changed" run, the email // is just the short Summary section. The first-ever run (no previous scan // to compare against) always includes the full detail report regardless of // this setting, since there's nothing to summarize yet. const onlyShowDetailsOnChange = false; // Number of days after which a stale last-backup is flagged in the Summary, // e.g. "⚠️ Last backup is more than 7 days old". Unlike almost everything // else in the Summary, this is NOT a scan-to-scan diff — it's a threshold // check against the CURRENT last-backup age, so it fires on every run where // the backup is too old, regardless of whether that changed since the // previous scan. Only relevant on Homey Pro models post-2022 (where backup // date is available at all — see showBackup above). const staleBackupWarningDays = 7; // Number of days of silence after which a Zigbee node is flagged in the // Summary as "not responding" (based on that node's own last-seen // timestamp on the Zigbee network) — the Zigbee equivalent of the // existing Z-Wave "newly unreachable" check above. Like everything else // in the Summary (other than the backup/battery threshold checks), this // IS a scan-to-scan diff: it fires once when a node newly crosses the // threshold, and again when it reports again. Some battery-powered // end-devices sleep for hours between reports by design, so a very low // value here can cause false positives — raise it if you see those. const zigbeeStaleDays = 3; // Battery percentage at or below which a device is flagged in the // Summary as low on battery (once, when it newly crosses this // threshold — same scan-to-scan diff pattern as most of the Summary). // Applies to any device that reports a battery percentage // (measure_battery), regardless of connection type (Zigbee, Z-Wave, // Wi-Fi, etc.) — not just Z-Wave, which is all the existing // showZwaveBatteryDevices toggle covers (and that only lists which // devices run on battery at all, not their current level). Devices that // only expose a plain low-battery flag (alarm_battery) instead of a // percentage are included too, as a simple yes/no. Devices of class // "car" are excluded — EVs commonly and normally sit below most // reasonable percentages while just going about their day, which isn't // a "replace the battery" situation the way it is for a sensor. const lowBatteryWarningPercent = 20; // Script version, shown in the email footer. Bump this if you modify the // script, so you can tell at a glance (or in a screenshot) which version // generated a given report. const VERSION = '1.7.0'; // The script's own name, so the email footer can say which script // produced it even if you rename it later. Read dynamically from // HomeyScript's own __filename__ global rather than hardcoded — confirmed // (by testing a run triggered the same way a real flow triggers this // script) that __filename__ resolves to "