Presence detection

Must be cleaned all topics go to the right subforum
Post Reply
pkrabben
Posts: 53
Joined: Sunday 09 April 2017 15:55
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: Almere
Contact:

Presence detection

Post by pkrabben » Sunday 09 April 2017 16:00

Hi All

I'm new to domoticz and trying hard to get a high learning curve.
I managed to do the basic light switching and now looking into scripting

I found this script about presence detection https://www.domoticz.com/wiki/Presence_detection
I tried this but for some reason my virtual switch (phone) keeps at the off state :-(

I checked that I can ping my Phone => ok
I checked that the check_device_online.py_192.168.3.217.pid file is created (so the script is running)=> ok

Do you have some more tips for me what to check so I can get this running.

Thanks in advance for your reply
Grtz
Paul

User avatar
lonebaggie
Posts: 106
Joined: Tuesday 31 January 2017 14:21
Target OS: Raspberry Pi
Domoticz version: beta
Location: England
Contact:

Re: Presence detection

Post by lonebaggie » Tuesday 11 April 2017 15:13

Beat Version now has new hardware device

System Alive Checker

This will create a switch that will change state when the ping fails or succeeds

gerard76
Posts: 64
Joined: Wednesday 22 March 2017 10:13
Target OS: Raspberry Pi
Domoticz version: 3.8153
Contact:

Re: Presence detection

Post by gerard76 » Tuesday 11 April 2017 15:22

Stable even

User avatar
emme
Posts: 781
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Presence detection

Post by emme » Tuesday 11 April 2017 15:29

Ping Hardware under RaspBerry PI is quite odd and gives false off sometimes.
This is not related to Domoticz, but its an hardware limitation...
By design, the onboard LAN share a USB BUS instead of being rietcly connected to the CPU.
this means it has to share resurces with all others devices (this also explain why rPI does not use Gbit ethernet ;) )

so... ping could be considered once the device looks to be stable in its state for about 30secs... (obtained by otherdevices_lastpdate) after this perid, you are about 90% sure about its status ;)

...but I repeat.. this is valid for Raspberry PI.... windows should be much more stable!!!
That's one small step for a programmer, one giant leap for me!
- - - - -
Raspberry Pi3 + AeonStick G5 + RFXCOMM433 + iRTrans Server + NodeJS
There's no stress in the mess!!

User avatar
lonebaggie
Posts: 106
Joined: Tuesday 31 January 2017 14:21
Target OS: Raspberry Pi
Domoticz version: beta
Location: England
Contact:

Re: Presence detection

Post by lonebaggie » Tuesday 11 April 2017 15:46

Thanks for the update .

Im running on Pi 3 . I use to check if my LIghtwaveRF LInk is down . Which apart from me testing it, it never has been. From what you are saying if the PI is under load the ping test fail and give a false reading.

Good to know, I will do some further testing and see if I need another solution

User avatar
emme
Posts: 781
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Presence detection

Post by emme » Tuesday 11 April 2017 15:56

keep in mind that it is NOT ALWAYS true.... it depends on many facors:
- available power
- cpu load
- network (local) load
- usb load
- other stuff

it could be... that it could give false results... that's why a delayed check would be a great workaround.... :P

PI is a great device... but of course it has some limits....
That's one small step for a programmer, one giant leap for me!
- - - - -
Raspberry Pi3 + AeonStick G5 + RFXCOMM433 + iRTrans Server + NodeJS
There's no stress in the mess!!

Leemur
Posts: 2
Joined: Saturday 15 April 2017 22:52
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Presence detection

Post by Leemur » Saturday 15 April 2017 23:02

Hello,
I'm new to this but I think I found out where the issue is coming from:

Code: Select all

  # currentstate = subprocess.call('ping -q -c1 -W 1 '+ device + ' > /dev/null', shell=True)
  currentstate = subprocess.call('sudo arping -q -c1 -w 1 '+ device + ' > /dev/null', shell=True)
I guess the script usedto use a regular ping to check the presence of the device, and now it is using arping
In ping command the option -W 1 meant timeout of 1 second
Problem is that with arping the -w 1 means a timeout of 1 microsecond! This is clearly too short for any device to be able to reply in time (usually the ping is around 100-500 milliseconds)
I removed -w 1 to use the default timeout and it solve the problem \o/

Hope it helps
Cheers

Ray-Man
Posts: 41
Joined: Friday 12 December 2014 20:03
Target OS: Linux
Domoticz version: 3.x
Location: Netherlands (near Zwolle)
Contact:

Re: Presence detection

Post by Ray-Man » Wednesday 19 April 2017 16:30

This was exactly what I was looking for (had the same problem). Many many many thanks for sorting this out! :D

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests