Device types code, createEvent/sendEvent question

When calling sendEvent or createEvent, what is the “displayed” attribute used for? I can’t find it documented anywhere.

For example, what is the difference between these two lines:

createEvent(name: “switch”, value: “on”, displayed: false)

createEvent(name: “switch”, value: “on”, displayed: true)

(https://graph.api.smartthings.com/ide/doc/event doesn’t document it.)

1 Like

I haven’t used it, but I would take a guess that it determines whether or not the event is displayed in the mobile app under the Activity Feed. Perhaps those events are still useful in triggering things in subscribed apps, but not useful in the feed. I would also be curious if an event is generated as hidden if it can still be queried in a SmartApp?

Perhaps @Jim the new documentation developer could help?

1 Like

@joshua_lyon is correct - it determines whether or not the event is displayed in the activity feed on the mobile device. The event can still be queried if displayed: false.

I’ll add this to my list to get the docs updated to reflect this.

1 Like

@Jim, this isn’t working like that. For example, in the z-wave garage door opener device type, there is the following code:def zwaveEvent(physicalgraph.zwave.commands.applicationstatusv1.ApplicationBusy cmd) { def msg = cmd.status == 0 ? "try again later" : cmd.status == 1 ? "try again in $cmd.waitTime seconds" : cmd.status == 2 ? "request queued" : "sorry" createEvent(displayed: true, descriptionText: "$device.displayName is busy, $msg") }
According to what you suggested, if cmd.status is 0, I should see something in the activity log. However, I don’t. I see the following in the “live log”, but nothing whatsoever in activity:

I can only take a WAG, but perhaps this happens because isStateChange is false, so the activity log ignores it? I’ll try to modify that (and hope it works) and will edit this reply with more information…

Edit: Yep … forcing isStateChange to true forced the line to be displayed in the activity log. It might be worthwhile to document that as well. For example:

displayed: if true, blah, blah will be displayed in the activity log. Note: if isStateChange is false, the entry won’t be shown in the activity log regardless of the value of displayed.

2 Likes

Is it possible to create the event, such that notification is sent out to all SmartApps, but the activity feed is not updated?

I’ve tried setting “displayed: false”, which successfully blocks the activity feed from being updated. But, it also prevents all SmartApps of being notified of the event.

I also tried setting “displayed: false, isStateChange: true”, which updates the SmartApps of the event, but also updates the activity feed.

Essentially, what I’m trying to accomplish is that I have SmartApps hanging off motion detectors. I want the motion detection changes to update the SmartApps, but I don’t want the activity feed cluttered with constant motion detection when I am walking around the house all day. I like to check the activity feeds to see what is happening, and these very frequent updates to the feed are making this impossible.

1 Like