Is there a way to call/trigger a function from one smartapp into another?


(Minollo) #1

As a consequence of handling some event in smartapp A I would like to trigger smartapp B to do something; but that trigger is not tied to a device event or a mode change event; it’s really more A triggering some kind of custom event which B can handle.

Is there a way to do that?


(Csader) #2

I’d be interested in knowing this as well.


(Todd Wackford) #3

The only way I think you can do it right now is to create a virtual device that when set by app A or the device tile is tapped, it creates a virtual event in that device that app B subscribes to. Its a good way to set device scenes that you want Tiles/Buttons for. You group those into a “Scene Group” which turns out to be a good way to see what Scene app is actually running.

@minollo, I think if you explain what you are trying to do in more detail, we can help with more relevant information.


(Minollo) #4

I’m not blocked by this; in absence of a cleaner way to do it, I’m relying on mode changes to trigger other app’s operations.

One simple example is handling of day and night; when I’m away, and the presence sensor detects I’m back, I would like to ask the “sunset/sunrise” app to take care of setting state to day or night depending on the various parameters it knows about; instead, right now I change the state to “home”, and I’ve added a mode change handler to the “sunset/sunrise” app to change “home” into “day” or "night.; that works OK for that specific problem, but it seems to me the need of letting smartapps interact with each other through custom events rather than just through device or mode events would be desirable to keep things clean and manageable.