Adding a new method to existing SmartApp and calling it from Device handler is not working

Hi, I’m new to ST dev and trying to improve a bit of code for my needs.
I added to existing Sensibo SmartApp a new method, say “MyNewMethod” and I’m calling it from Sensibo device handler, like parent.MyNewMethod(param) and getting error. I checked it with
if (parent.respondsTo('MyNewMethod')) { ... code ... } else { log.debug("not here: error") }

Whats I’m doing wrong that my device handler does not see smartapp new method?

Thanks

You can’t call a SmartApp from a device handler.

What are you trying to do? It may be that you just need to have the SmartApp subscribe to a device state, and then execute your method?

If my code reading correct then Sensibo SmartApp has the method

def setACStates(child, PodUid, on, mode, targetTemperature, fanLevel, swingM, sUnit) { ... do this ... }

and Sensibo DH has a code calling this method

def result = parent.setACStates(...)

I’m trying to do the same but with my new function

Where the source code for the smartapp and DTH? The DTH looks like it’s a child DTH calling that method in’t it’s parent DTH.

from here Sensibo integration

thanks a lot for helping

No problem! Let me take a look and see how this is put together.

1 Like

Ah, ok this is a service manager type setup. I haven’t done one of those in a very, very long time…

Does the smartapp and DTH work for you right now? What error are you getting when you try using your new method?

Basically it returns a very simple error without details “Sensibo FAILED to set the AC State”, so its just DH cant find my method in SmartApp code for some reason :frowning:
Yes it works ok without my changes

Wait, something weird going on with my code, I come back later

1 Like