RM bug: Editing triggers

I wanted to create a rule that would tell me the last Echo Spoken to, and I had a rule that uses triggers from LastSpokenTo changes. I use this as a virtual presence sensor. If someone speaks to a Alexa device it means someone is at home.

Anyway I cloned that rule as a starting point and deleted other triggers that were there. Motion being activated, switches manually being turned on etc.

This all worked as planned. I then wanted to use LastSpokentoTime instead of LAstSpokenToDevice so I started going through the triggers and editing each one and changing it from one to the other. It works great for 5 devices and then I just get a blank screen in the trigger section. See below:

If I click done I go back to the main Rule, and if I click edit triggers I get that screen again. So I can't edit the last two triggers. You can see from the screen shot below 5 of the 7 triggers have been updated. This has happened two times in a row. I can only edit 5 of them before this happens.

[Edit] I did a hub reboot to see if that would change anything and after which I get an actual error when I open the trigger page.

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String on line 866 (selectTriggers)

So this has happened again. I have another rule that is working and the last time I edited the rule it was okay. Haven't touched it several months. Now when I try to edit triggers I get the same blank screen I got in the screen shot from the OP. When I click the edit triggers portion, I get java.lang.ClassCastException: null (selectTriggers) in the log.

It uses some similar trigger types as the other I posted plus others. It is a activity presence sensor. When I originally wrote the rule I didn't think about triggering on a variable change. I was looking over some of my older rules and when I looked at this one I realized I could remove the individual echo device triggers and just look at my global that I set when a new echo is spoken to. I tried creating a copy but it does the same thing,

Oh my god, I've never seen so many triggers in the same rule. Does that run efficiently?

1 Like

Yeah it works fine. It's a simple rule if any of those triggers happen turn on a virtual presence sensor, and I never heard of there being a limit on triggers. If there is I guess I can break it down to multiple rules.

No, you're right. Multiple triggers have no impact on performance of a rule.

As for your editing problem, is this also from a cloned rule?

No I don't believe so. I wrote it some months ago, and my memory is not what it used to be, I am pretty sure i wrote it from scratch, though.

If you get an error again, please post the logs here that show it.

I had actually just opened up the edit window and was looking at it again when you posted.

This was in the log

java.lang.ClassCastException: null (selectTriggers)

Here is a screenshot. You can see the rule was activated twice earlier. I also still have a copy of the rule I created this morning and it still does teh same thing and gives the same error.

1 Like

Well, unfortunately that particular error is of no value to diagnose an issue.

It seems related, but I don't guess the error in the first post on the other rule that this happened on helped?

Just downloaded 2.2.4 and I get a different error, although very similar to the first one I posted in the OP.

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String on line 875 (selectTriggers)

Is this from editing a clone still?

No, this is from editing the rule. I deleted the cloned rule a few days ago. I had it paused but it was doing the same thing at the time I deleted it.

I should have also noted that instead of a blank screen I got an error message that said I should check the logs. I just went back to get a screen shot of that, but it now is back to just showing a blank screen. Also the error shown in the logs now is the same as the one you said was unhelpful.

java.lang.ClassCastException: null (selectTriggers)

OK, I have nothing to go on to know what's wrong with your rule. It seems as though editing is not going so well for you. Perhaps, before you edit, download the rule to your pc. Then, if it blows up editing, remove it, and restore the backup. I need to know the sequence of steps that causes the problem, screenshot of the before state of the rule, etc.

I can't really add anything new. I did as you suggested I exported the rule and removed it. Had not thought of trying that as it was just added. I then imported it back and it did the same thing. All I am trying to do is edit the triggers.

I click the trigger area to open up the triggers edit and I get a blank screen as shown in the OP.

The only thing I can do is click Done. It then goes back to the opening rule page where you select whether you want to edit the auctions or the trigger.

If it will help I can send you the JSON file it created. When I get a chance I will see what happens if I import the rule to my other Hub.

That rule is broken internally. There's nothing that can be done, and no way to know what the break is.

1 Like

Just had another one break. Can't even look at this one. This rule has been working for 6 months haven't touched it in that time. It's just a timer that starts when I leave for work and then sends a pushover notification when it's been eight hours.

I was sitting at my desk and looked at the clock and noticed the time and thought my timer should have went off. I looked at it in the global connector I have in my dashboard and it showed a quitting time of 10:00PM. So obviously something did not trigger this morning when I left. I decided to look at the rule and see if a scheduled job was set or if it never triggered and when I click the rule I get the following error. I am sure it's another nothing can be done but it's a bit frustrating.

groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.size() is applicable for argument types: () values: []
Possible solutions: is(java.lang.Object), find(), use([Ljava.lang.Object;), find(groovy.lang.Closure), div(java.lang.Number), sleep(long) on line 2463 (mainPage)

I tried cloning the rule and exporting and then importing the rule and the clone and import failed the same way. Now I just realized since I can't open them I can't delete them.

Yes you can. Just open the gear icon to the left in the apps list.

Odds are that this rule became corrupted in your database. Usually, a reboot will fix these things, but sometimes you have to do a soft reset and restore.

Went back three backups to one I did on 11-16 and still the same issue. I also rolled back my system two revisions same thing.

I had been reading that box at the bottom of the system icon as delete RM not just the rule. I thought it odd to have a delete RM option in every rule. I now see it says child instance.

I may try a few more backups I have them going all the way back to May. Hopefully I can find one where I can at least see the rule. I had thought before this that when you restored a backup it restored your system to the firmware version that you backed up from but apparently that is not the case.

So if I find a backup that the rule is not corrupt I can export it and then restore to my current database and then restore that rule from the json file?

Hard to know if it will work or not. Worth a try. But, at least get a screenshot of the rule...