This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

iPhone presence detection
#3
That shell solution assumes that your iOS device has a fixed IP, you can do in Lua like this. I cannot guarantee that this code will work, you have to try and debug it yourself Smile

Code:
function checkiosdev(ip)
  local sock, res

  sock = require('socket').udp()
  for i = 1, 10 do
    sock:sendto('123', ip, 5353)
    os.sleep(1)
  end

  res = os.execute('ping -c 2 -W 10 ' .. ip)
  return res == 0
end

seen = checkiosdev('192.168.1.10')
grp.update('1/1/1', seen)

When phone/tablet is locked (in sleep state) sending UDP packets to port 5353 causes it to wake for a short period. During that period device can be pinged to check if it's in the network or not.
Reply


Messages In This Thread
iPhone presence detection - by npinguin - 25.08.2016, 18:29
RE: iPhone presence detection - by edgars - 26.08.2016, 06:14
RE: iPhone presence detection - by DGrandes - 07.08.2018, 11:46
RE: iPhone presence detection - by admin - 29.08.2016, 16:37
RE: iPhone presence detection - by DGrandes - 05.07.2018, 13:05
RE: iPhone presence detection - by npinguin - 29.08.2016, 21:04
RE: iPhone presence detection - by rocfusion - 04.09.2016, 19:46
RE: iPhone presence detection - by admin - 05.09.2016, 06:00
RE: iPhone presence detection - by adiaz - 09.07.2018, 07:17
RE: iPhone presence detection - by admin - 09.07.2018, 08:19
RE: iPhone presence detection - by Daniel - 09.07.2018, 08:25
RE: iPhone presence detection - by DGrandes - 11.07.2018, 10:58
RE: iPhone presence detection - by Daniel - 07.08.2018, 12:18
RE: iPhone presence detection - by DGrandes - 07.08.2018, 14:21
RE: iPhone presence detection - by Daniel - 07.08.2018, 14:37
RE: iPhone presence detection - by DGrandes - 07.08.2018, 14:55
RE: iPhone presence detection - by Daniel - 07.08.2018, 16:09
RE: iPhone presence detection - by DGrandes - 09.08.2018, 12:27
RE: iPhone presence detection - by FatMax - 09.08.2018, 14:52
RE: iPhone presence detection - by Daniel - 09.08.2018, 16:16
RE: iPhone presence detection - by DGrandes - 10.08.2018, 09:44

Forum Jump: