well yea, that was implied, however that’s not where we’re at today. There is also nothing that we can do (other than being vocal) to prioritize anything, and you’ve been around long enough to know how well that works.
This is correct. If you accidentally published rule (like I did) you need to keep publishing it for each upgrade. It isn’t a big deal and it is easier to do that than to uninstall a multitude of rules in order to un-publish it. If I ever convert over to v2 hub I will remember not to publish rule the next time.
I seen in another thread, that I can’t find now, that you have a way to backup all the rules?
Because I have replaced almost all my smart apps into rule-machine this would be a very useful thing to have when converting from v1 hub to v2.
If a backup can be done can you enlighten us to how we can backup all our rules?
What I did was to take screenshots of each Rule on my phone. Then when I wanted to recreate them, those screenshots were all I needed, looked at on my computer as I rebuilt the rules.
@an39511 I did the same thing @bravenel did. I tried to install the code and keep my rules but had all sorts of problems. Once I started from scratch all was right in the world again.
If you have any trouble uninstalling the apps let me know. I had a big issue and was able to figure out quite a bit.
For anyone upgrading or new to Rule Machine. At some point, early in the process of setting up your rules, you must hit Done at the top level of Rule Machine. Remember, you are installing a SmartApp (Rule Machine). It won’t function completely or correctly until you hit Done the first time.
Rule Machine allows you to set up Rules and Triggers before you hit Done. That’s actually not a good thing, as some of you have found out the hard way. But that’s the way ST works at this point.
CLICK DONE in Rule Machine when you first install it. Then it will be under the SmartApps tab, and it should work fine after that.
I pushed a tiny update to Rule Machine that might alleviate this problem of not being able to delete old Rules.
Frankly, I missed testing the deletion of old Rules. I was focused on being sure that old Rules still worked, not thinking about what happens when they are removed. I’m trying with this update to protect against the error that is thrown when deleting an old Rule. The line 118 error. If we can get beyond the errors, which are my fault, then we should be able to move forward with deleting any Rule.
Such is the deal when you have a lone developer testing a lot of code. Sorry for the problems!
One more suggestion: Before you attempt to delete an old Rule, hit Done on the Rule Machine main page once. Then go back into it. That should help. The problem is that it doesn’t know about your old Rules; hitting Done allows it to see them so as NOT to throw the line 118 error.
Thank You Bruce! I love the detail and capability of Rule Machine but I seem to be having a couple of issues getting it to work consistently. I have few simple rules. For example I have one simple rule for my outside X-Mas lights that states “Time between Sunset -20 min and 10:30 PM EST”. I have the true condition to turn the lights on and false to turn them off. Sometimes it turns the lights off like it is supposed to at 10:30 and sometimes it doesn’t. Upon inspection of the condition yesterday morning, it said false, but the lights were still on. This morning on the other hand, they are off. What am I doing wrong? I have other rules written that seem to be behaving sporadically as well. Could it be a hub issue?
Usually these types of failures are due to cloud problems. Think about it this way, if the Rule ever works, and then it doesn’t work sometime, that pretty much indicts the cloud, as the logic of the Rule hasn’t changed between when it works or not.
You can do some diagnosis of what’s going on. Go into the IDE / My Locations / List SmartApps. Click on the Rule that you have issues with. A page with all of its state information will come up. You can look at the Scheduled Jobs. If those are correct, with a job scheduled for tonight at 10:30, that’s good. If it isn’t scheduled correctly, you should probably remove that rule and recreate it.
Underneath where the Schedule Jobs are you can see Job History. Look at the right, at Delay and Execution times. Odds are, that if they failed to turn off at 10:30 last night, you will see longer than normal times there. Normal times would be very short delays, less than 100 ms, and execution times of under 2000 ms. If you see either delay times or execution times that are much greater, then that is the point of failure, and it was a cloud execution failure. An app is only allowed to execute for 20 seconds, 20000 ms, before it is killed. That is why you read about Routines that run but fail to do all of their steps – they exceeded 20 seconds and were killed.
These types of failures can happen to any smartapp. One way to reduce the likelihood of this type of scheduling failure, is to move your time away from the hour/half-hour and away from sunrise/sunset. Believe it or not, ST gets swamped with events at popular times, and doesn’t keep up. Use an oddball time, and it’s more likely to work.
Awesome! Thanks for the help. I think you nailed it with your diagnosis. I didn’t realize you could view scheduled jobs from the IDE. Big help. Thanks!
On a separate note, as an attempt to fix the problem on my own, I went ahead and updated Rule to the newest release you just posted. I simply copied and replaced the code in the IDE and Saved. I didn’t publish. I went back out and now I can’t select actions for True or False. They simply spin the “thinking” circle and then it goes away and does nothing. This is what I had from the log:
9eed647f-3708-4ea0-bb31-268218b6917f 12:34:44 PM: error groovy.lang.MissingMethodException: No signature of method: script1449411986765910224727.ruleList() is applicable for argument types: (java.lang.String) values: [Outside X-Mas Lights] @ line 486
9116b89e-9be9-4e9b-a5e7-229f6669f044 12:34:44 PM: trace getPhrases(), state.welcomeIssue = null
If I try to hit “Done”, it says “Failed to save page: selectRule”. Log:
9eed647f-3708-4ea0-bb31-268218b6917f 12:35:29 PM: error groovy.lang.MissingMethodException: No signature of method: script1449418814478910224727.unSubscribeRule() is applicable for argument types: (java.lang.String) values: [Outside X-Mas Lights]
Possible solutions: unsubscribe(java.lang.String), unsubscribe() @ line 643
Upon trying to remove a single rule I get “An unexpected error occurred”. Log:
9eed647f-3708-4ea0-bb31-268218b6917f 12:35:56 PM: error groovy.lang.MissingMethodException: No signature of method: script1449418529253910224727.removeChild() is applicable for argument types: (java.lang.String) values: [Outside X-Mas Lights]
Any thoughts? Should I just remove everything having to do with Rule/Rule Machine and start over?
I’m not sure what you’ve done. Would be good to clear it out and start over. Follow the instructions in this post: [UPDATED] Rule Machine with Triggers
I am making another major update to Rule Machine this morning. This is Version 1.4.0. This update involves both Rule Machine and Rule.
This past Saturday morning (12/5/15), I released a merged Rule Machine, now with Triggers. Unfortunately, I didn’t structure the parent-child app aspect of that release properly. There were two child apps, one each for rules and triggers. That structure was flawed for long term development and support of Rule Machine.
Today’s release returns Rule Machine to a single child app: Rule. The entire functionality of Triggers has been incorporated into the new Rule release. This streamlines Rule going forward. All of the functionality that was announced on Saturday is preserved in this new release. However, there is one issue:
Unfortunately, any Triggers you created over the weekend with the Saturday release will no longer work. All of the Rules you have created will work. Before installing this update, you must remove any Triggers you created since Saturday, and recreate them in the new release. This will be the last structural change to Rule Machine that could cause such a problem. I apologize for the hassle this creates for some of you; I empathize as I had to redo about 30 Triggers.
Instructions for update:
Remove all Triggers from Rule Machine created since Saturday
I hadn’t created triggers, and I updated my Rule Machine and Rule, and deleted Trigr, and this is working perfectly for me.
You must have been very busy lately, and thank you for this work, I really like the direction this has gone. I use Rule Machine for everything Smart Lighting can’t do.
You mention not to publish “Rule” to your IDE. Is there any downside to doing so? It appears Rule Machine has worked when I published both the parent and child app.
Thanks for the Smart(est)App @bravenel!
Rule-machine is labeled version 1.2 in the code, although it’s today’s date so it’s probably supposed to be 1.4.0 like in the Rule code.
I’ve cleared and deleted my Triggers and Trigger Happy and updated solely to the new Rule Machine. I’ll start setting things up tonight.
You will not need Trigr any longer, it can be deleted (please delete any Triggers you created since Saturday first).
If you publish Rule, then I think you have to publish each time there is an update. If you don’t publish it, then you don’t have to republish it when there is an update.
Thanks. I update via GitHub and it’s very easy to just update both apps with a simple click of a button. I check off “publish” when I update as I noticed last time It didn’t work until I published. With GitHub integration, it makes sense to check Publish for both I believe.