Scene will not load --Cannot get property 'currentSwitch' on null object

Well, I upgraded to the latest version 2.2.6.137 Then I had deleted one of the lights included in every one of my scenes. Then I rediscovered the light (zooz zen72 dimmer). After that my scenes no longer work and when I go to add the light back into any of the scenes I get this error and in logs:

Error: Cannot get property 'currentSwitch' on null object

app:9612021-04-01 11:03:13.628 pm errorjava.lang.NullPointerException: Cannot get property 'currentSwitch' on null object on line 580 (mainPage)

This is the second time it has happened, before the same the occurred and I grudgingly rebuilt every scene and deleted all the previous ones. I really do not want to have to go though that again.

Please someone help!

I am suspecting the light / dimmer is re-created under a different internal id on the HE hub, so apps that contain references to the old copy of the device in the scenes don't know what to do, which is why you see the "null object" in the error message. I am not aware of a fix myself, but hopefully the HE support team or another community member may be able to help.

Did a prompt not come up when you tried to delete the device? Normally it shows dependencies on a device, confirming you are sure you still want to remove it? If it didn't that would also be useful for the support team to know.

Simon

No it did not show any information at all. However, the device was removed by z-wave exclusion process. But, other scenes that do not contain this light also stopped functioning and are not editable. Maybe, I did too many changes at once, upgraded hub, z-wave include/exclude.

I'm hoping that there is useful information in this experience. So, that maybe something could be determined as needing to be addressed to prevent such a problem.

I'm pretty sure any response I get will be to remake all my scenes (boo).

When you delete a device by using Z-Wave Exclusion, as opposed to doing it from the device page, that bypasses the opportunity for the UI to warn you about apps that use that device. Deleting a device without first removing it from any apps that use it will break those apps. Whenever you plan to delete a device, for any reason, look at the bottom of its device page. There is a list of all of the apps using that device. Before doing anything else you must remove the reference to that device from those apps.

One way to make this less painful is to first change the name of the device to be removed to something like "Bedroom Light Old". Next add the new device. Or if, as in your case, you intend to remove and later rejoin the device, create a virtual device to stand in for it in the app. Name that one "Bedroom Light Old", and remove "Bedroom Light" from the app. Then when you delete "Bedroom Light" from the system, by whatever means, you have left bread crumbs behind and intact apps. When the new device is joined, and named Bedroom Light, it is easy to go into those apps and change the selection from Bedroom Light Old to the new Bedroom Light.

This sort of care is required, The apps have internal data structures built using the devices that have been selected. It's not possible for the hub to know your intentions when you remove a device. All it can do is warn you if it's still in use, and that happens when deleted from the device page, but not from the Z-Wave Info page.

4 Likes

So thoughtful to take your time to give such a detailed explanation! :100: :+1:

I do know better, sometimes I suppose when one gets frustrated (z-wave, ohh the z-wave) one will jump to doing rash things to resolve problems which always turns out to only cause more problems. "STUPID--- YOUR SO STUPID" [UHF flashback]

Ok, well maybe the next time I have a z-wave device not responding I'll remember to go have a beer and chill for a moment before breaking my system completely! URRG

However your place-holder idea is very useful! Maybe there should be a post of top 10 does and don'ts as well as useful tips (like the ones provided here).

Again, thank you so much for you time and consideration!

./stephen

PS: Believe it or not, I did not plan on doing this on "April Fools Day", but how ironic!

1 Like

One more point: When using Z-Wave exclusion to remove a device, the hub doesn’t know what device you are removing until it’s been excluded. At that point the damage is done, too late to offer a warning.

1 Like

I'm experiencing the same issue. In my case, I deleted a device (a bulb) from the device page. Now, all the scenes that reference(d) that now deleted device crash and are uneditable ("Error: Cannot get property 'currentSwitch' on null object"). Also, cloning a scene also doesn't work (the clone remains uneditable).

I've done this in the past, and usually the scenes correctly remove the deleted device.

On the “status” page for the scene app, I see the deleted device is still referenced under “capturedDevs”, “oldDimmers”, and “otherMap”.

I'm on 2.2.6.137.

Never remove a device until you have removed it from every app where it is used. There is a warning when you go to remove a device about the apps it is in use by. Heed the warning. If you don't, some apps will be broken by the act of removal. That's why the warning is there.

There is one interesting thing to note in this process. IF you addressed that device in a Group and then used that Group of devices in the Scene. When you delete the device (ignoring warning) the Scene will remain operational, since the Group seems to handle its unexpected removal just fine.

Not all apps are broken by a device removal. It depends on the app.

I have this same issue, probably caused by Zwave. But I can't help but wonder about some defensive coding in the scene for this situation @bravenel . Couldn't the scene detect this null device and give us a chance to address it? Zwave is not without it's problems so it is inevitable that you have to use a hammer on some occasions to try to get things removed.

I too am having this problem. They should update to handle this the way webcore does, it just shows the obsolete ID and doesnt action it, not roll over and die completely.

This issue in Scene 1.2 is fixed in the upcoming 2.2.8 release.

2 Likes

@bravenel do we have to wait for the update before we can remove the app? I was tired and I am in the process of moving and I excluded switches before removing from apps

You can remove the app by clicking on the gear icon either on that page, or on the Apps list page next to that app in the list. At the bottom of the page that opens is a button to remove the app.

The upcoming 2.2.8 release has a fix for this issue, allowing these broken Scenes to not throw this error, but instead to identify the removed device and ignore it.

1 Like