[SOLVED] Issue with presence detection

I am having an issue with presence detection where my item gets set to ON then immediately “something” is setting it to “OFF” again.

I am using the script from this thread:

https://community.openhab.org/t/presence-detection-by-reading-leases-on-dhcp-server-it-works/38837

since my DHCP server on the network is not my router or even the rPI I am running OpenHabian on. I used to work, but then I tried to get presence detection by ‘networkping’ but that wasn’t working (it wouldn’t seem to use arping) so I switched things back and now this isn’t working anymore.

My Thing for my phone (added via PaperUI) is this:

Phone_Alan_IP

In my ‘default.items’ file, I have:

 /* Presence */
Location HomeLocation "Alan & Vicki"
Switch Presence "Someone is Present" <present> // master presence switch, represents to the rest of OH where someone is home
Group:Switch:AND(OFF,ON) Presence_Sensors <present> // all presence sensors belong to this group
Switch Presence_Timer { expire="5m,command=OFF" } // anti-flapping timer

// Presence: Alan
Group:Switch:AND(OFF,ON) Presence_Alan "Alan is present [%s]" <present> (Presence_Sensors)
Switch Presence_Alan_Phone_IP "Alan @ Home (Phone)" <network> (Presence_Alan)

From the thread above, the item the script from the thread above is 'Presence_Alan_Phone_IP. In the script, the command that is setting the item switch to ON is:

curl -X POST -d "ON" -H "Content-Type: text/plain" http://$OH_user:$OH_pass@$OH_IP:$OH_port/rest/items/$person

If I run the command manually (replacing the variables with the actual values), I can see in the Log Viewer that the “Prresence_Alan_Phone_IP” switch gets set to ON, but then almost immediately gets set to OFF (but there is no indication as to what actually sets it to OFF)

Any insight to what could be going on is appreciated.

You don’t describe what you did, but I would guess you still have a link left from that (so that the network binding is fighting with other updates).
Many bindings are not so good at picking up in-flight changes, a bundle restart might be enough.

2 Likes

Thanks for the reply! After posting last night, I actually did do a reboot and it seems to be stable now (log file not getting filled with “Presence_Alan_Phone_IP” going between ON and OFF every minute or so.

I am going to mark this SOLVED for now.

Thanks! :slight_smile: