Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Need LUA script to check if Android phones are at home


Question

Posted

I need a LUA script to check if my android phone is at home, I think it should be possible to check if the phone (its IP) is connected to the network at home. I have found scripts for iPhone but not for android.

14 answers to this question

Recommended Posts

  • 0
Posted

Make a script which gets the information from the dhcp table of your router. Search for any ip which has you android devices mac address. The router might assign your ip address to another device, and if you just ping a certain ip, any device which is assigned that ip will respond. The mac address should be unique to the specific device, so if you can ask for the mac address and it answers, you are home with your phone.

Please login or register to see this image.

/emoticons/default_icon_smile.gif" alt=":-)" />

  • 0
Posted

In theory yes. Anybody with a working scene/scrip in LUA based on wether a certain device/MAC is present in the network?

  • 0
  • Inquirer
  • Posted

    I got help from a member with a working script, but how do i find the ID of a virtualdevice? Could it be the number i enter in the "button.conf"? But it says ID:Button1 ??

    EDIT: If found out how to find deviceID, just position the pointer over the Devices list to the right

    [ Added: 2014-04-05, 21:08 ]

    The code for the button in the virtual device:

    Please login or register to see this code.

    The easy solution to find an open port on my Android was to install the "Sonos" app. I dont even have a Sonos device but it opened a port that i could ping, good enough for now

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />[/b]

    • 0
    Posted

    Dalle1985 anything to add to help with the precense of a certain MAC?

    • 0
    Posted

    I don't think the hc2 will do it for you unless you have a router which outputs the dhcp-table as json. I haven't played around with it myself, but I can pretty easily creath a small script on my webserver running linux which will sniff out ips and macs and stuff them into a piece of json. There are a few tutorials around the web on how to do this. It is even possible to get the name of each device i.e. "Dalles iPhone".

    • 0
    Guest Lode
    Posted

    I have an android galaxy s4.

    How can i find wich ports are open.

    • 0
    Posted
    I have an android galaxy s4.

    How can i find wich ports are open.

    there is not any!

    • 0
    Guest Lode
    Posted

    That's what you think......found it already

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    • 0
    Posted

    You have a magic phone then

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    • 0
    Guest Lode
    Posted

    Nope......download Portscanner app on your Phone.

    In the field ports fill in 1-60000.

    On my Phone he found two open ports.

    On another phone he found 3 open ports (not the same as first phone)

    I ran the LUA script and yes phone pinged

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    • 0
    Posted
    Nope......download Portscanner app on your Phone.

    In the field ports fill in 1-60000.

    On my Phone he found two open ports.

    On another phone he found 3 open ports (not the same as first phone)

    I ran the LUA script and yes phone pinged

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    You must have older android os or very trusting with apps

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" /> mine shows 0

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

    • 0
    Guest Lode
    Posted

    os kitkat

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" /> and it works so ?

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    • 0
    Posted

    Mine can work but relys on third party app opening the port... SONOS... ADB... Etc... Not native support!

    • 0
    Posted

    You could just send any Tcp request to the ip of your phone. If you get ANY response back, it must be because the phone is there, even though it is refusing the connection... I haven't tried it myself yet, but that should work.

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...