Rule Machine - Odd behavior when trying to edit existing rule

I had a rule that I wanted to update. I had an ELSE statement at the end that I wanted to make an ELSE-IF. When I clicked EDIT and selected the ELSE line and tried to make it an ELSE-IF I got an 'Unexpected Error' message. When I went back into the rule everything after the ELSE statement is gone and when I go into select a new trigger I get a blank page (sort of) that only displays the 'DONE' button. I can still EDIT the ACTIONS though.

It's not a big deal I can recreate the rule, it isn't that complex. I was just curious if anyone else has seen this behavior.

After rebooting the hub I get the following error when trying to add a trigger.

Unexpected Error

An unexpected error has occurred trying to load the app. Check Logs for more information.

Error: java.lang.Integer cannot be cast to java.lang.String

Please take a screenshot of the logs when this error appears. Post that and a screenshot of the what's left of the rule.

Here is the log:

Here is the triggers screen:

Here is what's left in the rule:

I was trying to replace an ELSE statement with an ELSE-IF statement after the ELSE-IF statement that is still listed in the screenshot above. Everything after the ELSE-IF was deleted. The END-IF didn't exist at the time. I added that after the error to see if I could still edit the rule.

I am now getting another error. I recreated the rule that I had an issue with and saved it under a different name. I was able to edit/update the new rule just fine last night. This morning I went in to make some changes and now when I click on the actions of the new rule to edit them I get the 'Unexpected Error' page. A screenshot of the log is below.

I really need to see the rule to have any clue what is going on. So show me the main page of the rule, and the App Status page (gear icon) screenshots.

Here are the screenshots. My screen capture software on this computer doesn't allow a scrolling capture.













Do you know what you tried to edit that caused the error?

Not regarding this rule. As far as I recall I was able to edit the set color line of the ELSE-IF and the delays in the ELSE statement last night. I didn't have an issue until I tried to reopen actions this morning. This is a different rule from the one I opened the thread for.

I know exactly what caused the error on the other rule that is having issues. This was the rule I opened this thread for.

I now have two rules throwing errors. I did not copy the other rule.

OK. It's not possible with this error to have any clue what went wrong unless you can reproduce the exact steps that cause the error. Something went off the rails, clearly. If you can't open them to be edited, you will need to remove them and recreate. I wish there was more I could tell you, but there isn't.

Okay, thanks. I'll delete and recreate.

On a different topic. I looked all over for an answer to this question. Is there a way to capture what device caused a triggered event and then use that device name in the logic of the actions?

The triggering event device name can be used as a string: %device%. That can be used to set a String variable, and that variable can be used in Conditional Actions to compare that name to other string values. The triggering event value is %value%.

Set DeviceName: %device%
IF(DeviceName = "FrontDoorContact") THEN ...
ELSE-IF(DeviceName = "BackDoorContact") THEN ...
etc.
1 Like

I'm not sure at this point what is going on. I am now getting an error in Motion Lighting.

I went into 'Groups and Scenes'. Created a group, then created two scenes, then deleted a group.
Went into Motion Lighting. Edited an existing app by unselecting 'Set these dimmers per mode' and then selected 'Select scenes per mode', selected two modes. The moment I clicked the second mode name the following error popped up.

I then went into a different Motion Lighting app performed the same exact steps within this app and it generated the same error at the same point. Opened the motion app, unselected 'Set these dimmers', selected 'Select scenes per mode', selected two scenes, upon selecting the second scene the error screen pops up. The error popup comes up every time I try to open either of the Motion Lighting apps now. Below is the screenshot of the log.

I can still go into Motion Lighting and create new apps.

There is a bug in Groups and Scenes that is responsible for this. This has been fixed and the fix is in the upcoming 2.1.7 release.

Okay. Is there a way for me to get them back or do I need to recreate them?

I went in to recreate the Motion Lighting apps and now I am getting the error. I can no longer create motion lighting apps. I uninstalled motion lighting and then reinstalled it. If I try to create a new motion lighting app it generates the error when I click 'continue' on the Name this Motion Lighting page.

I was able to create a New Mode Lighting App. I don't know if it works, haven't tested it.

At this point should I just do a restore? I didn't want to do that in case you wanted logs or something else from me.

It is probably your Groups and Scenes that is causing this. Please provide a screenshot of the Groups and Scenes parent app App Status.

I did a restore this morning and re-built everything so I don't have that to send you. I'm pretty sure there is a bug when editing rules though. If I'm doing something wrong please let me know.

Here are the repeatable steps:
Create this rule (Notice I forgot to add the sub-expression for the AND statement)
image
Edit action ‘IF basement bath…’, Edit expression, "Insert before expression element", “Basement bath window 1A”, select “(“, Insert before expression element AND, select “)”. You’re left in a situation where you can’t save the changes. If you click “App List” it doesn’t save the rule, if you click the gear icon and then click “Go to app” it takes you here:
image
Click ‘select actions to run’ to edit the actions and it takes you back here:
image
With no way to save the edit.

It was during these steps that led me to make this post. It ended up creating a rule that caused the error I posted. In that case I was trying to replace an ELSE with an ELSE IF.
If this isn't a bug please let me know what I am doing wrong.

OK, I will try your steps...

I just did these steps on a nearly identical action, and it didn't leave me in a situation where I couldn't save the changes. It presents an error after inserting the ( -- mismatched parens.

Then after I add the ) it brings up a button "Done editing expression".

I click on that, and that brings up a button "Done with Conditional Action".

Click on that, and it goes back to the main Action page, with the parens inserted into the expression and the Done with Actions button.

Once you click on the gear icon you are abandoning the expression editing midstream. Try it again step by step, and if it doesn't match what I showed above, stop -- and post here a screenshot of where it is at. We then might try something to dig deeper.

I get different results.
After inserting opening paren
image
After inserting closing paren


I don't get the button, I get "Double operators"