Understanding error message "java.lang.NullPointerException"


#1

1) Give a description of the problem
I try to run a routine, that turns off a bunch of lights and dims one to 5%, but it throws up an error message while executing the routine

2) What is the expected behaviour?
Lights go off and a single light dims to 5%

3) What is happening/not happening?
Routine is stopped from executing

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full

28.11.2021 13.14.24 +978ms
+0ms 	╔Received event [Home].mode = Netflix with a delay of 49ms
+65ms 	║RunTime Analysis CS > 14ms > PS > 11ms > PE > 39ms > CE
+67ms 	║Runtime (40385 bytes) successfully initialized in 11ms (v0.3.113.20210203) (66ms)
+68ms 	║╔Execution stage started
+76ms 	║║Comparison (string) :3850b17977192f27c04bfe3eade36b57: changes_to (string) :3850b17977192f27c04bfe3eade36b57: = true (0ms)
+77ms 	║║Cancelling condition #8's schedules...
+78ms 	║║Condition #8 evaluated true (5ms)
+80ms 	║║Cancelling condition #7's schedules...
+81ms 	║║Condition group #7 evaluated true (state changed) (8ms)
+83ms 	║║Cancelling statement #9's schedules...
+94ms 	║║Executed physical command [Reol Lampe].off() (6ms)
+96ms 	║║Executed [Reol Lampe].off (8ms)
+102ms 	║║Skipped execution of physical command [Reol Lampe 2].off([]) because it would make no change to the device. (3ms)
+103ms 	║║Executed [Reol Lampe 2].off (5ms)
+130ms 	║║Skipped execution of physical command [Rund Lampe].off([]) because it would make no change to the device. (24ms)
+131ms 	║║Executed [Rund Lampe].off (26ms)
+140ms 	║║Executed physical command [Stuen - Lille lampe (ny)].off() (6ms)
+141ms 	║║Executed [Stuen - Lille lampe (ny)].off (8ms)
+149ms 	║║Executed physical command [Stuen - Standerlampe 1].off() (5ms)
+150ms 	║║Executed [Stuen - Standerlampe 1].off (7ms)
+159ms 	║║Executed physical command [Stuen Loftslampe].off() (6ms)
+160ms 	║║Executed [Stuen Loftslampe].off (8ms)
+166ms 	║║Skipped execution of physical command [Udestuen].off([]) because it would make no change to the device. (4ms)
+167ms 	║║Executed [Udestuen].off (6ms)
+169ms 	║║Cancelling statement #11's schedules...
+180ms 	║║Executed physical command [Standerlampe 2].setLevel([5]) (7ms)
+181ms 	║║Executed [Standerlampe 2].setLevel (8ms)
+183ms 	║║Cancelling statement #13's schedules...
+648ms 	║║Skipped execution of physical command [Køkken Lille Lampe 1 Bridge].off([]) because it would make no change to the device. (4ms)
+649ms 	║║Executed [Køkken Lille Lampe 1 Bridge].off (6ms)
+655ms 	║║Skipped execution of physical command [Køkken Lille Lampe 2].off([]) because it would make no change to the device. (4ms)
+656ms 	║║Executed [Køkken Lille Lampe 2].off (6ms)
+657ms 	║║An error occurred while executing the event: java.lang.NullPointerException: Cannot invoke method hasCommand() on null object
+659ms 	║╚Execution stage complete. (591ms)
+660ms 	╚Event processed successfully (660ms)

#2

Should check that the devices are properly selected

Note:

this suggests you have the device not properly selected for that statement.


#3

It appears something isn’t quite right with Køkken Lille Lampe 2 in your @Kitchen global.

I’d suggest you make sure it is authorised properly via the SmartApp. Perhaps deselect it, update, reselect it, and update again. Then edit the global variable definition and save it again just to make sure everything is up to date.


#4

That’s the Location comparison so it is OK. The logs expose the underlying IDs that are the things actually being compared.


#5

Seemed like the issue was that I had a global group nested within another group.

Do by chance you know if that is a widespread problem or just me in particular?


#6

Think that is a new one on me