sendEvent from a SmartApp: handler behavior

From the API reference, I noticed that a SmartApp can issue a sendEvent. If there is no device name specified, then
I read that it becomes an “APP” event. Where is such an event sent? Who receives it? How can I write a SmartApp to receive such an event?

1 Like

This section of our docs should help you out:

Yes, of course. I’ve seen that.
My question is if my regular SmartApp sends an event, who receives it? from the API there is nothing that specifies the intended receiver.

When you send a location event the location receives it.

What is the use of a regular sendEvent( random data ) ?
it’s not connected to a device and not connected to a location

SmartApps typically respond to events, not create them. In more rare cases, certain SmartApps or Service Manager SmartApps may have reason to send events themselves. sendEvent can be used for those cases.

Yes, I read that. That is very confusing and vague text.
What is the definition of "certain SmartApps?
I understand service manager apps.

Does the text mean only service manager apps? If it is, I recommend just saying that. Or there are some other “certain SmartApps” that can receive events sent from an arbitrary sendEvent(random data). Otherwise it’s plain confusing.

You’re not alone with this concern, @earlenceferns.

I have come up with at least one legitimate case for a sendEvent from a SmartApp, but it failed, and the documentation does not explain why.

I started a private message stream with an ST engineer @beckje01 who was going to review my test case, but he didn’t get back to me, so I’ll try to follow-up.

In general, a SmartApp should (per documentation) be able to sendEvent as if it were coming from any Device authorized to the SmartApp. But doesn’t seem to work. Perhaps it has to be a child Device of a service manager as per discussion here.