Groups and scenes app crashes when opening scene

When opening one of my scenes the app crashes and throws a null pointer exception.

java.lang.NullPointerException: Cannot get property 'displayName' on null object on line 364 (mainPage)

I believe the issue was caused because my scene contained a switch which was no longer part of my system. I noticed this and opened the switches selector to try and force it to remove the null device from the capture list. The app immediately crashed, and I have not been able to open that scene again since.

It would be nice if we could edit the app states when there was a catastrophic error like this. This is the second such error I have encountered when setting up hubitat. The first I encountered early in my port from smart things. I was able to resolve it by deleting the affected app and redoing my configuration. At this point though I really would rather not have to update all my rules that reference this scene.

Any suggestions on how to repair the scene without having to rebuild it from scratch?

Not the issue I am facing. Yes they are both null pointers but being thrown by different bits of the code.

That is the motion lighting app crashing. This is the scenes app crashing.

Yes, once you remove a device it damages any app that uses that device. In this case, that app needs to be removed and recreated. We are making the warning on device deletion stronger so that people do not make this mistake. Meanwhile, I will look into trying to avoid the null error in Scene.

Is there any way to edit an app's settings (via text), if so I believe I can get myself out of this situation with that.

No, there is not. Scenes (and Groups) uses a special method of device selection that is vulnerable to behind its back device removal. That Scene is permanently messed up, and must be removed.

I have put in the fix to prevent this in the future. I'm not able to reproduce the failure you got, although there are other null errors with such a Scene.

To reproduce you need a switch in the "switches" array for the scene which is not in the "otherMap". Have failed to get back into this situation with a couple attempts with a test scene.

However, handling the case where the otherMap does not contain one of the switches in the scene would allow 'recovery' of this scene.

Was able to "Fix" by overwriting the scene via the http://{{hubitat-ip}}/installedapp/update/json api. This allowed me to keep the scene's id and avoid rebinding all my rules. Basically 'updated' the existing scene to be an exact copy of one of my known good scenes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.