Presence Sensors

We don’t currently have a cloud endpoint that would accept this type of request at this time.

You should be able to do this with a hubitat driver and avoid the cloud altogether.
Folks that have written some lan device drivers can chime in, i currently don’t have any code tidbits to offer…

Thanks. That's kind of what I was imagining. Seem like if its all local the router should be able to send something to the IP of hubitat to accomplish pretty much the same thing.

1 Like

This is definitely possible and would be more reliable on Hubitat since it’ll be a local endpoint. Do you a SmartApp on ST that creates this endpoint and controls the virtual presence sensor? Should be fairly easy to port over. If you have the SmartApp code, you can start a new thread here and we can help getting the code ported over.

I used this one (I’m unable to post URLs, but I think you can figure it out. :slight_smile:


The smartthings forum post is here for the asus router presence sensor script.

1 Like

@mike.maxwell, @mattw, @dalenberg

My HubDuino (ST_Anything) supports Child Presence Devices. This was a recent addition for a ST user (long story...:wink: )

I am guessing that the Asus router code could be modified to send the properly formatted LAN packet (no OUATH required) to my HubDuino Bridge Driver / Service Manager App / Child Presence Sensor Driver. It just needs a LAN packet that contains the string "presence1 present" or "presence1 not_present" for the driver to parse() and create events for the service manager to use to automagically create child devices and keep them up to date.


I gave that code a shot, it works great. I added this to the update method so I could get the right urls:

def updated() {
    log.debug "away url: ${fullLocalApiServerUrl('away')}?access_token=${state.accessToken}"
    log.debug "home url: ${fullLocalApiServerUrl('home')}?access_token=${state.accessToken}"

Here is what I get in the logs:

2018-03-15 16:12:33.795:debughome url:
2018-03-15 16:12:33.790:debugaway url:

here are the commands I used to invoke:

curl -X POST ""
curl -X POST ""

With the new version of the hub 1.0.3 (available today) you can also call it like this:

curl -H "Authorization: Bearer 2a16f329-7e13-4d62-b925-7682abdc7985" -X POST ""
curl -H "Authorization: Bearer 2a16f329-7e13-4d62-b925-7682abdc7985" -X POST ""

I must be missing something here. I followed the guide here adding in the log.debug you showed above, edited the CheckUser file to just have my and my wife’s phone mac address and replaced the curl commands as you’ve shown above, but with my own ip, api # and access tokens. I’m getting the following error on the CheckIfHome script:

./CheckIfHome: line 13: qcsapi_sockrpc: not found
[: 0: unknown operand

If I try to post the curl command directly, I get a html error 500 response to:

curl -X POST "http://192.168.x.x/apps/api/391/home?access_token=fa7a7129-0382-4f53-xxxx-bf659f9f5226"

I got it sorted out. Whew.

I seem to be missing something. I cannot get anything to show up in my logs. Totally empty. Not just for this app/device, but for everything. What am I missing, I’m sure its probably pretty simple. Thanks in advance

Can you give the steps necessary to find my appid? Also the API #? I'm brand new here, so I may figure it out on my own, but it's taking me a while to understand how to find these things. :slight_smile:

At this moment, I have the app installed, I added the debug code you provided. I even created a virtual presense sensor and used the app and pointed to that sensor. But cannot find the info to add to my router script.

Thanks in advance

For each copy of the AsusWRT Wifi Presence app you install, selecting the (i) will give you the app id in the url at the top <ipaddress>/installedapp/status/<appid>

And if you selected oAuth when you installed the app driver, the access token will be listed as well on that page.

Awesome thanks for the tip. I’ve now got two presence sensors working with my asus router. Same as I had with ST. I like to use wifi for unlocking doors, because it requires me to be even closer to the house.

In order to get the Asus presence i need to install HubDuino right? I have it all working on smartthings.

Ummmm, no. Asus Presence is a combination of an Asus Router and an OAUTH App running directly on the Hubitat hub.

HubDuino is used for integrating an Arduino or ESP8266 with Hubitat. Two completely different things.

Earlier, I was only suggesting that one could follow the HubDuino design in order to implement Asus Presence on Hubitat without the need for an OAUTH App.

Sorry for any confusion!

No? I have an app installed in Hubitat called AsusWRT wifi presence.

Asus also supports IFTTT and can trigger something (i.e. a Hubitat virtual switch) when a device connects. However, and for unknown reasons, they don't have an IFTTT service for when a device disconnects, unlike TP-Link and Google WiFi which support both connect and disconnect triggers.

can you point me to this app

Scroll up: I think it's just the smartthings app unedited.

Is there a ping command that we can use in a dh? If yes then this could be a way to detect presence. But only if our phone is getting static IP from the router. @mike.maxwell is this possible?

I installed the app and then added a virtual sensor. When i try to hit
http://192.168.2x.x/apps/api/324/home?access_token=xxx i get error 500 from a browser.

324 is the url when i goto http://192.168.2x.x/installedapp/status/324

any ideas what i am missing should this work in a browser?