sendEvent to device from the SmartApp

The doc said that I could send a event to a device from the SmartApp using:

void sendEvent(Device device, Map properties)

http://docs.smartthings.com/en/latest/ref-docs/smartapp-ref.html?highlight=sendevent#sendevent

Do you have example? I cannot make it work as expected. (nothing in recent activities in the device recent tab)

Yah… That doesn’t work. I’ve had a message open to one of the Engineers for months now… He promised to look into it, but has reneged twice.

I don’t have an exact working example handy, but I might find my notes somewhere…

Basically, you can call the sendEvent property of a device to set its own Attribute, if I recall correctly…

device.sendEvent(...)

1 Like

has this issue been fixed now ?

Interested in a solution too, I’ve never been able tu make this method (sendEvent) work. The best I can do is not to make my smartapp fail, but no events are raised at all.

Did anybody got this working in the meantime? Would like to use it this way without the need to create a custom command in the device.

Nope, still isn’t working as described in the docs, just been 3 years. @Jim should this be removed from the official docs?
If one tries to call sendEvent on a child device from a parent app it calls the parse method :))

Thanks, made it work using parse, if documented right it can be used as if the event was coming from the device, just need to pass it with createEvent in parse.

not sure how you are doinig it but works fine for me… i use my modified smartalarm to send notifications to my alarm status device ie

def reportStatus()
{
log.debug "in report status"
if (settings.haveNotificationDevice)
{
log.debug “notification device = $notificationDevice”

log.debug "not null"
def phrase = ""
if (state.alarms.size())
{
phrase = "Alert: Alarm at ${location.name}!"
notificationDevice.deviceNotification(phrase)
log.debug "sending notification alert: = $phrase"
def zones = "Zones: "
state.alarms.each()

and

metadata {
definition (name: “Smart Alarm Notification Device”, namespace: “lgkapps”, author: “Larry Kahn kahn@lgk.com”) {
capability “Notification”

and

def deviceNotification(String desc)
{
log.debug “in device notification"
log.debug “desc = $desc"
def parts = desc.split(”:”)

if (parts.length == 2)
{

def command = parts[0]
def value = parts[1]
log.debug “command = $command value = $value”

switch (command)
{

In smartapp I now use standard sendEvent(device, [name: xx, value:yy])

In the device in the standard parse routine, in short

Def parse(message)
evt = createEvent(message)
return evt

I used custom commands before.