I am losing my mind trying to figure this out, some maybe someone can shed some light on this for me please.
I have a SmartApp that I’m creating and the individual functions work as they are supposed to (custom created functions, etc.). I’ve even confirmed the SmartApp is installed on my mobile phone correctly.
I created a Device for what I’m working with, and I can see it has States (Door Control states of open and closed). This seems to be working properly as well.
HERE’S MY PROBLEM: I’m creating the Device Handler which will use the Door Control capability, and when I put in my own open(), close() opening() and closing() methods they look as though they work properly. HOWEVER, when I try to call a function built within the SmartApp (aka. parent.doSomething()), it fails with a response of:
error java.lang.NullPointerException: Cannot invoke method doSomething() on null object @line 123 (open)
I have my SmartApp and Device Handler both in the same namespaces, so looking over other examples of SmartApps and DH’s, I am assuming that I can use the object reference “parent.”, but apparently I’m mistaken.
Am I thinking of this wrong? Are SmartApp’s not considered a parent object to a Device Handler? If not, how can I reference the SmartApp methods or appSettings (aka variables) from within my Device Handler?