When I Googled this I found some links from several years ago that said there was not a direct way to see the “in use by” for modes…
I assume that’s still true? It would be really handy.
When I Googled this I found some links from several years ago that said there was not a direct way to see the “in use by” for modes…
I assume that’s still true? It would be really handy.
“In use by” can tell you which apps are using a device.
That’s always been the case, and hasn’t changed, AFAIK.
I think this can be done using a custom app. I’m on vacation this week, but I’ll take a crack at it next week.
Try the app at the github link below (the app is too big to directly post here). The app should report which Rule Machine and Button Controller rules use Modes as well as which rules use While, Repeat, End Repeat, Stop Repeat, Wait for Expression, and Wait for Event. There is a Last Run timestamp for each rule.
NOTE WELL: This app can take a LONG time to run if you have a lot of rules; a bit over 10 minutes for my main hub with over 300 rules.
ALSO: Indirect mode references are not detected. Rules that set or test modes via hub variables or custom commands will show only a dash in the Modes column (can’t detect them as yet).
This is beta software.
https://github.com/JohnFLand/Rules-Special-Actions-Scanner/tree/main
EDIT: screenshot -
I don’t use modes much, just created a couple of rules for testing purposes, so I invite your feedback as to whether the app in post #4 seems to work for you.
John, your app worked great for me for modes (which, for me, are all “sun-based”, dividing the day into DAWN, DAY, DUSK, EVENING, and NIGHT, with many other rules acting accordingly).
While testing it, I did note something interesting: there’s an awful lot of undeleted cruft stored in many of my rules. As part of this, rules which no longer use Repeated Actions still have keywords in them that your app picks up.
An example: here’s one of my current rules…
…and, from that rule’s “Application State” list:
The Repeats and Cancel were removed from the rule when “command retry” was added to devices; amusingly, the “Front Foyer stairs” were in a previous house, which we left over 3 years ago, when I copied this rule to handle the strips under the stairs in our current garage.
I’m idly musing about writing some code for myself that might “de-cruft” RM rules: deleting “actions” that no longer appear in the “actionList”, as well as some “clipList” and “locVars” and “varSettingsOld” nonsense which appears to be equally out-of-date.
Try v. 1.09, which filters key word “hits” found only in stale/leftover entries (deleted actions, clipboard, old settings) so that they are flagged by a red check mark. This might help if you ever create a “de-crufter”.
See post #4 for the link (and all versions have an importUrl).
Details of the approach change in the code (implemented in 1.07 – never published – and debugged in 1.08 and 1.09):
* 1.07: Fixes mode detection for Rule Machine 5.x / Button Controller. RM does not use "mode"-type inputs; it stores mode selections as plain enum settings holding mode IDs, using naming conventions:
* modesX mode trigger selections (e.g. modesX1 = ["4"])
* modes mode condition selections (e.g. modes2 = ["1"])
* mode. Set Mode action target (e.g. mode.3 = 4)
* modesY legacy mode restrictions
* The scanner now also matches settings by these name patterns and translates the ID values to mode names via location.getModes(). Values that do not map to a known mode ID or mode name on this hub are ignored, which filters out unrelated settings that happen to match the name pattern. "mode"-type inputs are still detected as before.
I recently had a case where I wanted to see the "In use by" of a large number of devices (I was moving from devices brought in from HADB to the new local Ecobee integration [RELEASE] *any* hub (C5/C7/C8) Ecobee No Cloud HAP Thermostat (Local) — direct control of an Ecobee thermostat, no Apple hardware).
I wish there was a single display of "In use by" for all devices.
The link in post #4 and below is now to v. 1.16 that differentiates between a key word (e.g., “Repeat”) appearing in an action versus appearing in stale rule “cruft”.
https://github.com/JohnFLand/Rules-Special-Actions-Scanner/tree/main
Been out of pocket…but THANKS John…will give this a shot!