Is it possible to initiate a SmartApp via HTTP POST or GET?
I’ve been doing this via a virtual switch as the smartapp initiator (subscribing to “on” events, then resetting it in the event handler) and then flipping it using URLs in the example OAuth script provided by SmartThings (happy to share links if you need 'em).
So far I like the virtual switch trigger solution – even though it creates some “clutter” – because it also allows various smartapps to trigger one another via switch flipping.
Yeah, that’s what I’m doing for most of my SmartApps to that I’m triggering via Ubi. Just wondering if there was a “cleaner” method to do it.
I’ve got 20 different virtual button tiles running now for various apps and setups. As you said, it works and it does have the advantage that apps can call other apps using this method.
But I’m trying to limit the steps involved in setting up an advanced Ubi/SmartThings operation. For someone who’s relatively new to ST and/or Ubi I trying to share some of the nice stuff that can be done between the setups, but the instructions end up being extensive and complex.
Are you guys creating the virtual button tiles manually or can you create them as child devices in the SmartApp?
I create them manually.
You should be able to do something like this in your smart app to make the device:
def child = addChildDevice("smartthings", "On/Off Button Tile", "uniqueDNI", null, [label:"Fancy Tile Name", completedSetup: true])
However, I get this error when I try to use ST default device types:
physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘On/Off Button Tile’ in namespace ‘smartthings’ not found. @ line 40
This code works fine if I change it to a custom device type. Maybe someone else knows if it should use a different namespace.
I would think using this type of auto device creation should make install and uninstall cleaner for what you are doing?
Interesting… I didn’t know about this. Unfortunately it won’t work for my setup. Ubi needs to be able to see the device as a stand alone device so it can use it as a trigger or as an action.
Actually, you don’t need to create multiple virtual buttons. You can have one device acting as a bridge between multiple apps using undocumented ‘data’ field in the event class. This is how Aeon Minimote device type is implemented. All buttons send the same message - “pushed” or “held” with the button number is encoded in the ‘data’ field. Then “Button Controller” app parses data filed to figure out which button was pushed. I believe you can extend this mechanism to pass arbitrary messages between the apps.
@geko That’s an interesting idea. I’ll have to check it out.
@chrisb Child devices do show up in the My Devices List and in the “Things” section on mobile devices, so I think they can be used like normally devices. I think it just provides convince for the SmartApp to create, destroy and act upon the devices.
Did you ever got this to work? Is there a way to use the stock devices with “smartthings” namespace or does it only work for custom ones?
@625alex I didn’t really play around with it any more past what I posted. Sorry.
Maybe @Ben can hook you up with someone who knows how to have a SmartApp select by device type for standard ST devices.
I’m pretty sure the
addChildDevice() call only works for child devices that you own. That would explain the UnknownDeviceTypeException error you saw.