ActionTiles tile with TRIGGERcmd bookmark URL
-
Is there any way to run the URL from a tile without opening a new window? This would be the best way to add it to action tiles since the switches are on/off instead of momentary buttons, so i dont like the look of random switches being on when thats not actually the active thing. If i could just use a shortcut URL tile without it popping up, that might be the way to go, assuming it still fires the script. im running this in Fully Kiosk. Maybe i can block pop ups in fully?
-
@elnorte13524, that's interesting. I run ActionTiles with Fully Kiosk and I tried to do the same thing and had the same problem - my button opened another browser tab to the bookmark URL that I had to close every time.
I actually posted a suggestion on the ActionTiles forum asking them to add a feature to be able to send an HTTP POST to an API instead of pulling up a URL in a browser tab.
As of a few minutes ago if you append &close=true to the end of your bookmark URL, the page will auto-close as soon as it opens. The Fully Kiosk browser honors the javascript close() command without prompting you.
Like this:
https://www.triggercmd.com/trigger/bookmark?token=BLAHtokenBLAH&close=true -
@russ nice, thank you! im going to edit my URLs and set that up later today. Thatll work in AT, and thats really what im worried about right now.
-
Adding the statement at the end works to close the tab, the problem i have now is that Fully will open either into a window within fully but wont close that, a new fully instance, or a chrome tab where it closes that tab but then stays in chrome. I cant get it to just open one chrome tab, close that and go back to fully. I wonder if it would work different if it was the only chrome tab, though, then when it closes the tab it might go back to Fully. Ill have to test that on the tablet when i get home, i have 30 tabs open on my phone that i (might) come back to, so i cant test it until i get home. Did you make any changes to Fully for it to work within Fully to open the tab, run the command and close it to go back where you were in Fully?
-
Another question - is it possible to edit the .groovy to make the TriggerCMD switches into buttons? It would make for a cleaner look if they were momentary button tiles instead of toggle switches. Right now half of them are on, which on an AT panel just looks weird to me, showing 3 playlists as "on".
im still working with the bookmark URL in an AT shortcut, i just havent gotten it working right to open then close the window in fully.
-
@elnorte13524 yes, it's possible to change the groovy code if you don't mind having all virtual switches auto toggle back off as soon as you toggle them on. The older groovy code used to do that before I added parameter support.
Remove the // in front of the off() in the device handler in this section:
// handle commands def on() { log.debug "Executing 'on'" sendEvent(name:"switch",value:on) parent.on(this) // off() }
Also, remove all lines inside this off(childDevice) function except the debugOut line:
def off(childDevice) { debugOut "Off request from child device" def dni = childDevice.device.deviceNetworkId //Russ def Params = [ token: "${atomicState.token}", uri: "/api/run/triggerByID", body: "trigger=${dni}¶ms=off" ] apiPost(Params) { response -> debugOut "OFF result: ${response.data}" } }
I think a better solution would be to make the virtual switch toggle itself off immediately only if the command doesn't have parameters turned on. I would need to add some code to the server side to accomplish that.
-
@russ ok cool. so the device handler would look like:
**// handle commands
def on() {
log.debug "Executing 'on'"
sendEvent(name:"switch",value:on)
parent.on(this)off()
}**
And the then this is also the device handler? Would look like this:
def off(childDevice) {
debugOut "Off request from child device"}
}
is that what you meant? Making them momentary buttons would make it work much better in AT for me. I wouldnt need them to be links and try to close the page, i could just use them as a button to run the command on the computer. Thanks again for the help!
apologies for the weird formatting, i cant figure out how to correct it so it looks like code, the way you did in your comment
-
@elnorte13524 actually that off(childDevice) function is at the end of the Smartapp code, not the device handler code.
Also I see that Action Tiles developers are going to create a way to call an API so you won't have to use SmartThings.
Also to make your text show up as code you have to indent it at least four spaces.
-
maybe ill leave it alone until i can use it directly from Action Tiles with the API. i tried to edit the code but broke it all, so i had to paste the original code and itll be work how it is. Thanks for the help, though, this is an awesome app.
-
Bringing this back up. Is there a way to totally remove the state of the virtual switch? I am doing speaker/amp commands and it would be nice to just have them not there.
-
@djmalcom, I used to have the SmartThings code immediately turn the switch back on every time you turn it off, so effectively it's always on. I left the line that did that remarked out. Just un-remark (remove the //) that off() line.
// handle commands def on() { log.debug "Executing 'on'" sendEvent(name:"switch",value:on) parent.on(this) // off() }