Is it possible to get information from router?


I would like to write a smart app that would get some information from my router (either via telnet/ssh or http)
and according to the response it should do something.

Is this possible ?
I haven’t written any smart apps yet and I don’t know the guidelines.


Yes, http is possible

1 Like

is there any simple example which I could check ?

and, ssh/telnet is not possible ?

What information are you trying to get?

I will write a script on my router which pings a specific device and provide “present” /“absent” status.
The result should be processed as a presence sensor on the ST platform.

Scripting is cool, searchfu is cooler


thanks. I agree that “searchfu is cooler”

But the DD-WRT example is a little different than what I was looking for. In that example, router triggers the ST platform. I was looking for a way to query router from ST Hub. Because if I do that, I won’t need access to cloud for just pinging something inside my house.
Is there an example for that reverse query mechanism ?

In any case, I would like to try the DD-WRT example.
But I couldn’t understand how to fill up


What will be the URL to call there ?


maybe my instructions in the post below will help you understand better. the URL is built using the standard ST API calls and the oauth app id and key

further reading is available here

1 Like

thanks. That’s really helpful.
But it is based on a smart app.
What about if I want to directly update presence of a virtual presence sensor ?

Where do I get the URL for that ?

I’m confused. (couldn’t combine the DD-WRT example with Fuzzyligic’s explanation on ASUSWRT Wifi Presence)

I create the DD-WRT example device as a device handler. Then I create a device from it.
How do I get the URL to update it ?


you need a smartapp to do the status change of the presence sensor. you cannot configure Oauth derectly on a device type without a smartapp. so you do need a smartapp to enable the mapping for the URL and then trigger the device type.

the smartapp is simple to customise to trigger the action you want.

1 Like


so I first create a device from example presence sensor codes.
then I create a smartapp (also from example codes)
then , shall I have to add a device from the device handler I create in the first step ?

what will be the network ID to use there ?

and I don’t understand in the DR-WRT example below; there’s only one code for smartthings platform. Which one is that ? device handler or the smart app ?

yes you create a device, the Network ID can be anything you want. I just use the same name as the device, it just has to be unique.

the code in that discussion is a device type. the post says

Next, you need to setup OAUTH endpoint access. That is covered elsewhere.

this part is best handled by a smartapp, the one from my post will do this fine

1 Like

At the moment and for the – long – indefinite future, you cannot deploy any custom code to your Hub.

So even if you wrote a SmartApp that uses the LAN based hubAction() commands to query the router, this will execute in the SmartThings Cloud.

1 Like

@Fuzzyligic thanks. I am trying to use the example in your post.
I installed the virtual presence sensor device handler and then created a device from it with network ID 3000

Then I installed the smart app.
At this point I understand that I should install an instance of it with the virtual presence sensor device I just created.
So I select thet presence sensor and give a name. I don’t select any modes.
When I tap “done” app says : “unexpected error occured”

So, I can’t install the app.

What is the reason ?


ok; I got it.
It was because I didn’t enable OAuth in the app…

1 Like

Unsure as this doesn’t happen with me, the only way to see is to look at the live logging window in the IDE when you try to save the page

1 Like

Ok. I got it.

Now I am trying to add some other features to this.
So I first start by adding a tile to your device handler.

But it doesn’t show up.

I just added :

  		standardTile("right", "device.presence", width: 2, height: 1, canChangeIcon: false,  canChangeBackground: false, decoration: "flat") {
			state "present", label: "IP", icon: "st.thermostat.thermostat-right"

what might be the reason for not showing up ?

I am actually trying to send router’s external IP address to the app to show up on the virtual device.

figured that as well. I had to add the new tile into “details”.

Now , how can I get a dynamic value from the router script ?

Instead of sending /Phone/home , how can I send a parameter ?
and read it on smartapp ?

how can I pass a value to the smart app ?
I read on some thread that parameters could be received with a notation like:

path("/devices/:id") {
    action: [
            GET: "getDevice",
            PUT: "updateDevice"

But how can I send the :id from http ?


I figured out that I have to use format: /Phone/ip/123.456.222.111?access_token=
to send HTTP
and to receive it use:

    path("/Phone/ip/:ip") {
    action: [

but I could not find how to send it to the device here:

def updateIP(ip) {

so, couldyou help me on this ?