An error has occurred while subscribing: java.lang.NullPointerException: Cannot get property 'v' on null object

variables

#1

I get this error every time this piston runs. I’m not sure how to troubleshoot it… any ideas?

12/19/2017, 8:15:47 PM +671ms
+1ms ╔Starting piston… (v0.2.100.20171211)
+511ms ║╔Subscribing to devices…
+540ms ║║An error has occurred while subscribing: java.lang.NullPointerException: Cannot get property ‘v’ on null object
+548ms ║╚Piston successfully started (548ms)


#2

You have a rogue device in the device variable at the top… looks like a remnant of the piston import process where a device wasn’t referenced in the wizard.

Try deleting it.


#3

Actually I broke that testing it… here is the current one… same problem.


Piston not running?
#4

Not sure if it’s the same problem as earlier, but if you look at your piston, you have lots of ‘minuses’ next to the statements. The statements will never subscribe to events.
Try changing them to either auto subscribe and if that doesn’t work, always subscribe.
Sounds familiar :wink:


#5

Do you have @allPresence set up and are all the devices in it valid? I get the identical error on my end until I add a global @allPresence variable.

Unfortunately I waited until after debugging through the code to try that. Why did it have to be a null pointer on .v when there are over 600 instances of .v in the code… heh


#6

Im not following you… Could you edit in what you are referring to and send it.


#7

@allpresent is a global variable.
Have you set up that global variable with your presence sensors that you are using.


#8

Where to I set it at?


#9

When you’re editing the piston the right side pane has a place to add global variables that can be used by all of your pistons. It looks like the original author of this piston used one called @allPresence that you would also need to add.

Click + add a new global variable then select Device as the type and fill out the name. You can select whichever presence devices correspond to “everyone is home.”

Then you’ll see the variable and be able to use it from any piston:

37 PM


#10

That was it!


#11

Nice catch!


#12

I’ll track this down in the smart app to ensure that a more meaningful error is shown when a global variable is not found. Glad it’s working for you now!