Presence sensing based on lqi and rssi

devicetype
sensor
presence

(mike tarrant) #1

Hi Guys,

I tried a search but came up empty handed, I had an odd smartthings presence sensor experience today where my parents across the road had their sensor show as arrived when it hadnt been moved all week and it hasn’t marked as arrived in error either since having it (a couple of months now). I can see from the activities that its found its way to the hub with a very low lqi and very low rssi (37% and -95dbm respectively).

Is there any way to code the presence sensor to only be marked as arrived providing the lqi and rssi are above a minimum lqi and rssi. (im not sure if we can access that data in the presence sensor, and if so how?)

Thanks in advance for any info anyone has.


(Bob) #2

Maybe this modified DTH would help:

Also, what was the battery level when the false arrival occurred? I’ve found that when they get down to ~50% they start acting flaky, and it’s time to replace the battery.


(mike tarrant) #3

Ill give that a go, thanks! and funny enough its just hit 50% on its latest arrival.


(mike tarrant) #4

Just a quick update for anyone that was also curious about doing this, I think I have something working, although I havnt had much testing of it coming and going yet. (and the virtual sensor simulator didnt seem to want to do what I wanted) I can forsee some issues in my code at the moment but i’ll report back asap.


(mike tarrant) #5

Ok so I ran into my first hiccup today, a presence sensor thats previous LQI and Rssi values were below my recommended stopped it showing present however the values were now old and need to be updated. From my other sensor im guessing it waits to be marked as present before updating its battery and signal info.

Is there any way to request the device to update its battery and signal info? If so im thinking of adding this into the parse presence message to then parse the battery and singal strength to update before marking it as present.


(mike tarrant) #6

I found these refresh commands in a different device type handler. Im not familiar with any of these things though, is there any documentation I can refer to for sending requests to the device, its the smartthings presence sensor device.

//Common refresh commands
refreshCmds = refreshCmds + [
“st rattr 0x${device.deviceNetworkId} 1 0x402 0”, “delay 200”,
“st rattr 0x${device.deviceNetworkId} 1 1 0x20”, “delay 200”,

    "zcl mfg-code ${manufacturerCode}", "delay 200",
    "zcl global read 0xFC02 0x0010",
    "send 0x${device.deviceNetworkId} 1 1","delay 400"