Basic Device Handler Smart App Data Passing

smartapp

#1

I have a device handler and smart app. A python script is calling a URL on the smart app to update certain values. The smart app then calls a command onthe device handler to update these values. It all work but seems a little clunky. Specifically when I look at the smart app in the “Recently” area it always shows "Sent to ". How can I update the value without having to go through calling a command on the device to do this. I am using a device handler that has something like this tileAttribute(“device.STATUS”, key: “PRIMARY_CONTROL”)

I would think it would work like

Python script calls URL on smart app
Smartapp URL reads passed data
Smartapp updates device - something like “device. = value”

Thanks


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

The only way to update an Attribute is to use sendEvent().

Presumably, sendEvent() can be called directly from a SmartApp as long as you have the Device Object Handle:

http://docs.smartthings.com/en/latest/ref-docs/smartapp-ref.html#sendevent
void sendEvent(Device device, Map properties)


#3

I am getting this error
groovy.lang.MissingMethodException: No signature of method: script15082856699822023344452.sendEvent() is applicable for argument types: (java.util.LinkedHashMap, physicalgraph.app.DeviceWrapper) values: [[name:test1, value:2017-08-25 22:20:44 -0400], …]

In App
private void updateAll(device){
log.debug "Inside UpdateAll"
sendEvent(device, name:‘test1’, value:request.JSON?.LASTUPDATE)
log.debug request.JSON?.LASTUPDATE
log.debug “Leaving UpdateAll”

In Device Handler Metadata
attribute “test1”, ‘number’

Any help is appreciated.