Room Lighting : Error cannot cast null object

I noticed that my hall lights were not turning off and wondered if that was because in Room Lighting the means to turn off was set as both inactive motion detectors and a virtual switch. I was wondering if both had to be true in order for the lights to switch off or just one of those conditions?

However when I looked at the log I saw this?