Rule machine mixed up. How to clean it?

It may be my fault but anyhow, how can I clean this mess now? In the process of getting the best rule, I have modified, copied, and modified again and again several of my rules related to ikea blinds. Now it’s getting fairly close to what I really like but somehow, there are still some weird behaviour sometime. I just discovered the problem now because in the device F6 (this is how I called that one) it said that it is used by the rule machine related to all the other blinds. So I opened the RM for blind F1 and there was no reference to F6 in that one. Decided to edit it anyway. In editing, I see the conditions were mixed up. One of the condition was related to a deleted variable, and another condition was simply FALSE (blank condition I guess). I could delete the condition related to the deleted variable, but not the empty one.

Then, clicking on the gear icon, I could see a few lines in that list that were not related to this blind.

Is there a way to edit the RM in raw? Otherwise, how can I clean that up?

Unfortunately there isn’t. You could take a screenshot of the rule, delete it and recreate it or you could restore from a previous backup and edit it.

2 Likes

That is definitely what I would recommend as well.

Seriously? I have about 12 of these one mile long rules. :weary::weary::weary::weary::weary:

Then restoring a previous backup might be the best option then allowing you to restore previous good state so you can edit.

The thing is that I don’t really know when this mixed up occurred. And I have made so many changes....
It might be easier to retape them all.

I’ll retape one and see if that one stays clear before doing all the others.

I guess we should never delete a RM without deleting local variables first. That might be the problem.

A key reason I don't use RM - no export/import. :slight_smile:

2 Likes

It's my understanding the "In Use By" is not accurate, it might have been part of the rule at one time but now is not doesn't mean it is causing any issues.

With that being said, yes it's possible a rule needs to be re-written as with significant edits, they can get wonky, Bruce has chimed in many times and when he says, the rule should work like it's written and to rewrite, the user most often comes back and says, that did it. I personally have had several that when rewritten fixed whatever was going on

My suggestion is to only re-create a rule if you feel it's not working as written, not all of them.

Good luck

1 Like

I see. Ok, I recreated one rule and now it’s 100% clean. No bad reference, nothing. Not surprised that they all wrong, I used the clone option.

@JasonJoel what do you use if you don’t use RM? You write your own for each need?

Wondering what application to use to decompress a backup? Maybe I could correct the files manually in the backup and the restore it!

It's an H2 database file.

1 Like

In the past I would write custom groovy apps. Worked great, just a little tedious.

Today I use Node-RED (via the Node-RED hubitat node set) for all of my logic.

1 Like

Not saying you don't have wonkiness in a rule, however the reference to another rule in the "in use by" is not causing the issues and conditions in any rule can be cleaned up just by selecting that section when editing the rule and use the delete option. You can also use the edit option to update parameters such as <50 in the rule can be easily changed to <55 by editing the condition rather than deleting the rule entry and recreating it

You may already know this, however just wanted to point it out

1 Like

Yes thank you. Indeed I had figured it out :wink:

There is some behaviour with the blinds that I'm not sure if they are caused by the blinds not responding, or if it is because of the hidden crap left in the RM. I'm going to try the newly created ones for a while and see.

Thanks @aaiyar for this info about H2 database. Downloaded it and learning how to use it now :wink:

@JasonJoel this sounds interresting. I watched the youtube about Node-RED. Sounds more complex than coding groovy itself. Anyhow, I've got a few evenings to learn all that stuff. Thanks

Definitely not. Take a peek at the node-red thread on this forum if you want to see some actual examples. Typically 100% drag and drop, zero code.

1 Like

Let me reiterate what @JasonJoel said. I'm not a programmer. It took me probably a couple weeks to move all my automations from Hubitat to Node-RED.

This is the Node-RED thread that he referred to:

You may this one to also be useful:

Wow, you guys got me really interested. Going to read this now. I sure hope this is nothing that requires internet to run my devices... I’m aiming to freedom more and more.

Absolutely not. However, you will need an external permanently-on computer that runs Node-RED. Something like a Raspberry Pi would be adequate.

Ho I see. Then this is not for me. Thanks.

I’ll stay with the rule machine then. It should be enough. I will try coding groovy and write drivers and apps. I have installed IntelliJ but didn’t figure out yet how to see the zigbee library and the HU library.

Thanks guys

1 Like

No worries. Good luck!

1 Like