In use by bug

The app status page (gear icon top right in the app) does it still show that device as selected?

Did you clone a rule, by chance? Bruce has mentioned that this will cause the "in use by" section to get stuck with the "old" devices from the rule even if you change them out (harmless but not helpful if you're trying to figure something out).

@bertabcd1234 I saw the same thing and was able to find the device under manage or Create Conditions under the Actions part of the rules (at the bottom of the page). Removed the ones I didn't want and it no longer reflects as "in use by" It seems the if conditionals stay even when you delete it from the if then expression. Hope this helps.

1 Like

In general, the "in use by" section is not going to be updated when devices are removed from a Rule Machine rule. This is harmless.

1 Like

It might be harmless but I have found the "in use by" section very useful in the past (for example when replacing one device with another) and if it's not updated correctly on edits it kind of defeats the object of it IMO.

Noted, and on the list for a future release. If it's super important to you, either don't remove devices from rules or remove the rule.

4 Likes

app status page attached. I deleted the rule and created it a new and that has cleared the incorrect reference in the device page. I am going to drop this for now, until I have another show up. I swear the device was never used in that rule, but stranger things happen I suppose.

EDIT: " Sorry so late with my response.....had a doctor appointment this morning. I see Bruce's comment so perhaps I'm not losing my mind after all. "

.

I am also seeing erroneous "in use by" references in some of my devices. I'm new a user and was populating a number of rules including cloning so not sure I have the sequence to reproduce. However, in one instance I remember I cloned a rule and then had to reverse the switch settings. The remaining erroneous switch is in the application state page indicating "on" when it was replaced by off states. There is also a duplicate entry that seems wrong too.

I find the "in use by" info to be very valuable and desire it to be accurate.

(Unable to include screenshot, as posting tool not letting me.)

I think they are aware of this bug which I believe started when RM4 was introduced.

I agree with you though, I found it very useful when it was accurate but it's a bit of a chocolate teapot at the moment.

1 Like

This is what causes that issue (not specific to Rule 4.0 but introduced not long after). The only way to avoid it at the moment is to create new rules rather than cloning (or clone a rule that doesn't use devices yet if possible). This is a known issue--not a problem per se, but definitely not helpful when trying to use the "In Use By" feature.

I don't think it is just cloning that causes the issue. I'm sure one of mine is caused by the rule not updating the in-use list when a device is removed from a rule.

I think you're right about that too, but that hasn't been discussed quite as much. I suspect if you work backwards and remove the device before removing the action, etc., you might be able to work around that one, but I haven't played around with that much.

@Geoff_T Try the fix i posted and see if that helps.

It is true that removing a device from a rule will often not clear the In-Use setting for the device. It turns out that doing this would actually be quite difficult. You can see the selected devices in the App Status Settings for the rule. If this bothers you the fix is to remove that rule and recreate it without deleting any devices. To avoid it in the first place you would have to diligently deselect any device you don’t want. If you delete an action odds are good that any device in that action is still “in use”.

Perhaps a utility that would wipe all "in use by" entries and then step thru all rules to recreate a fresh table. Would that be possible Bruce?

Anything is "possible". But this is really unlikely to make it onto a priority list of things that need to be done in lieu of all of the other things that need to be done.

Simple to reproduce:

  1. New rule
  2. Add On switch action, select one device, save action
  3. Add Off switch action, select one device, save action
  4. Delete first action, save rule, exit rule editor

Now if you view rule settings you will see that both devices are present and they will each show as being is use by this rule.

I don't think it has anything to do with cloning. When cloning you always need to edit rules and the editing is where the devices are not being cleaned up.

I suspect it would disappear if you took Bruce's advice and removed the device first, then deleted the action. I know this isn't ideal, but settings in Hubitat's current app model get messy quickly for complex apps like RM (not sure if you've ever tried to write a Groovy SmartApp in ST or an app on HE--very similar model), so this is probably the best users who depend on this feature can hope for at the moment.

If there were an option on the Rule Machine main page to "wipe" the used by references, then we could update it as we open and save rules.

I don't think it's that simple--I'm guessing the spurious "In use by" devices are just ones that got saved as an app setting somewhere (including when an action is deleted without removing the device first), and if you erase all settings, what you've done is...started over creating a new rule, which you can already do to get rid of these references. (The work to weed out which settings point to devices would likely be possible but not worth their limited time and would land you with a bunch of broken actions, which are also not always fun to fix.)

Here's an idea: create a virtual device of each type you might want to use it in a rule and name it something that makes that apparent. Use that in your "parent" rule that you clone. Then, no matter what you do, the worst you'll get is the already-fake devices spuriously referenced as you go into each new child and switch it out for "real" devices. (I think you can avoid this problem in non-cloned rules by working backwards any time you want to change or remove an action: de-select the devices first, then the action, etc.) If you've seen any example rules I've posted for people, this is usually what I do, which is why all those devices have weird names. :slight_smile: