Virtual Button To Trigger A URL

I don’t have any programming experience but I used to be able to get by using sample scripts and modifying what I need to modify. I can’t seem to find a script that will trigger a URL for me.

Short version:
I have something set up in webcore so when I visit a URL, it triggers something. https://graph-na04-useast2.api.smartthings.com/api/token/somethingsomething
I have a virtual button set up but I don’t know how to have it trigger or “go to” that URL when I push it. There’s a place in the script that looks like:

def on() {
push()
}

I’m guessing the command would go there. I’ve seen complicated scripts that are supposed to get a URL in there but nothing that just let’s me paste the URL into it. I’ve seen some that break it down into HOST and PATH but then there are a lot of other things in there as well and it didn’t work. If I open a browser and go to the URL it works fine.

Longer story: I want a door sensor to trigger a message. I have google minis so I set up webcore and assistant relay so I can sent messages to the minis. Maybe I don’t even need a virtual switch but in my head it SEEMED easier. Just create an automation that says, if this sensor then push this button.

Thanks in advance for the help.

You shouldn’t need the virtual button. Just create a webcore piston that says “if door changes to open, then POST to the URL”. Should be pretty straight forward.

Keep in mind I’m not a programmer. For me it’s easier to go on my phone, select automation, and set up things that way. So if I have a button, I can use my phone to set up the automation that pushes the button. If you would like to send me a webcore script and tell me what to replace so I can use my sensor and send a POST command, I’ll take that too but sounds more complicated.

Actually, after playing around for hours, I was able to set up a piston that works with LANnouncer. So when I test the piston, it sends the message I want to LANnouncer. That was a pain since almost everything I found referenced the keybounce website which seems to be offline. Then after figuring that out I realized that I don’t need a piston if I can just have ST send the POST to LANnouncer directly. Again, need to be able to send a POST command from a button so I can either trigger the piston or just go directly to lannouncer.

Spending HOURS trying to do something simple like get a message out over a speaker when the door opens. Sheesh!

I think I found it. With this I can create a button and just change the path to have LANnouncer say whatever I want. I do plan to learn more about programming in smartthings and webcore but for now this makes life easier.

1 Like