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

Detect mobile device presence via wifi connection (HCL)


goose2600

Question

I would like to know if it is possible to set a variable (ie admin presence in the house) by checking if a specific mobile device is connected to the same Fibaro LAN (could be very useful to automatically disarm the alarm).

I own a Fibaro HCL, firmware 3.593.

Thank you.

Link to comment
Share on other sites

18 answers to this question

Recommended Posts

  • 0

In my point of view, you can use a virtual device to ping your mobile device every second to check if your mobile device is connected to your network. if it is connected, set the variable to IN and create a scene with the trigger factor of variable to IN, and disarm the alarm.

Link to comment
Share on other sites

  • 0

I have a virtual device that logon to my Unifi (Wifi AP) controller to see if the phones of the family members are online. Some scenes depends on the status of that virtual device (lights, alarm, etc).

Link to comment
Share on other sites

  • 0

I use trigger android app to start a scene on hc2 when wifi is connected and again to start a scene when wifi is disconnected!

This method works for any wifi point... eg work and when leaving work start certain scenes at home ready for my return!

I also use this method to set the user gps ping in hc2 to 1min interval when i am away from home but 60min when connected to a known wifi point! (saves HUGE amount of battery power)

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thank you guys!

    If I understood I need to:

    1) create a variable related to admin presence in the house;

    2) create a device which provide to ping or check for open tcp port (as explained in the thread suggested by murnko) on my mobile phone and set the variable value;

    3) create a block scene logic that "push" the virtual device button every X seconds.

    I tried using a virtual device to ping my mobile, but I can't get it working.

    I even tried NET library to look for any open port in my phone (as explained in the thread suggested by murnko), but I got no success... and I don't know why!

    Moreover, I cant't find anything related to logging or debugging in my HCL.

    Would be very useful if someone can kindly provide the right code!

    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" />

    Link to comment
    Share on other sites

    • 0
    I use trigger android app to start a scene on hc2 when wifi is connected and again to start a scene when wifi is disconnected!

    This method works for any wifi point... eg work and when leaving work start certain scenes at home ready for my return!

    I also use this method to set the user gps ping in hc2 to 1min interval when i am away from home but 60min when connected to a known wifi point! (saves HUGE amount of battery power)

    Tasker is another best automation app for android which can start a scene on hc2,or click on a button in the virtual device(on HC2)..and it has huge amount of triggers(wi-fi on/off or gsm network cells near)

    The good thing is that you don't need code to put on HC2 and tasker has as a trigger when you login to your private SSID

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I use trigger android app to start a scene on hc2 when wifi is connected and again to start a scene when wifi is disconnected!

    I'd rather to use ping or to check for mac address (because my girlfriend who does not have android), but this looks like a good idea!

    I use Tasker.

    Which command do you use to start a scene or to push a buttond on a virtual device?

    Thanks

    Link to comment
    Share on other sites

    • 0
    I use trigger android app to start a scene on hc2 when wifi is connected and again to start a scene when wifi is disconnected!

    I'd rather to use ping or to check for mac address (because of my girlfriend who does not have android), but this looks like a good idea!

    I use Tasker.

    Which command do you use to start a scene or to push a buttond on a virtual device?

    Thanks

    http:///api/callAction?deviceID=15&name=pressButton&arg1=2

    [ Added: 2014-07-14, 22:30 ]

    HOME BUTTON:

    HC2 = Net.FHttp("192.168.0.8",80);

    HC2:setBasicAuthentication("idontthinkso", "hahaha");

    local payload = '{"id": 2, "tracking": 60}';

    response ,status, errorCode = HC2:PUT("/api/users", payload);

    if tonumber(status) == 200 then

    fibaro:debug("GPS was set to = 60");

    fibaro:setGlobal("MICKEYMOUSE", "HOME");

    fibaro:call(154, "setProperty", "ui.Label1.value", "HOME");

    fibaro:call(153, "pressButton", "16");

    else

    fibaro:debug("Status = "..status);

    fibaro:debug("Error code = "..errorCode);

    end

    [ Added: 2014-07-14, 22:31 ]

    AWAY BUTTON:

    HC2 = Net.FHttp("192.168.0.8",80);

    HC2:setBasicAuthentication("idonthtinkso", "hahahaha");

    local payload = '{"id": 2, "tracking": 1}';

    response ,status, errorCode = HC2:PUT("/api/users", payload);

    if tonumber(status) == 200 then

    fibaro:debug("GPS was set to = 1");

    fibaro:setGlobal("MICKEYMOUSE", "AWAY");

    fibaro:call(154, "setProperty", "ui.Label1.value", "AWAY");

    fibaro:call(153, "pressButton", "17");

    else

    fibaro:debug("Status = "..status);

    fibaro:debug("Error code = "..errorCode);

    end

    [ Added: 2014-07-14, 22:32 ]

    good luck with the ping... afaik ios blocked it early 6.x and android the same in jellybean... the tcp ports are now blocked you would need

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • [ Added: 2014-07-14, 22:30 ]

    HOME BUTTON:

    HC2 = Net.FHttp("192.168.0.8",80);

    HC2:setBasicAuthentication("idontthinkso", "hahaha");

    local payload = '{"id": 2, "tracking": 60}';

    response ,status, errorCode = HC2:PUT("/api/users", payload);

    if tonumber(status) == 200 then

    fibaro:debug("GPS was set to = 60");

    fibaro:setGlobal("MICKEYMOUSE", "HOME");

    fibaro:call(154, "setProperty", "ui.Label1.value", "HOME");

    fibaro:call(153, "pressButton", "16");

    else

    fibaro:debug("Status = "..status);

    fibaro:debug("Error code = "..errorCode);

    end

    [ Added: 2014-07-14, 22:31 ]

    AWAY BUTTON:

    HC2 = Net.FHttp("192.168.0.8",80);

    HC2:setBasicAuthentication("idonthtinkso", "hahahaha");

    local payload = '{"id": 2, "tracking": 1}';

    response ,status, errorCode = HC2:PUT("/api/users", payload);

    if tonumber(status) == 200 then

    fibaro:debug("GPS was set to = 1");

    fibaro:setGlobal("MICKEYMOUSE", "AWAY");

    fibaro:call(154, "setProperty", "ui.Label1.value", "AWAY");

    fibaro:call(153, "pressButton", "17");

    else

    fibaro:debug("Status = "..status);

    fibaro:debug("Error code = "..errorCode);

    end

    [ Added: 2014-07-14, 22:32 ]

    You were very friendly!

    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" />

    Does this set of instructions works in HCL too?

    Actually, I have not yet understood what are the functions that HCL can use in virtual device (compared to HC2)...

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Since HCL has not LUA, I thing I will work server-side (on my router or NAS) and also using Tasker app for Android.

    Now I have just to understand how to set a variable via http API command.

    Link to comment
    Share on other sites

    • 0
    I use trigger android app to start a scene on hc2 when wifi is connected and again to start a scene when wifi is disconnected!

    I'd rather to use ping or to check for mac address (because of my girlfriend who does not have android), but this looks like a good idea!

    I use Tasker.

    Which command do you use to start a scene or to push a buttond on a virtual device?

    Thanks

    http:///api/callAction?deviceID=15&name=pressButton&arg1=2

    [ Added: 2014-07-14, 22:30 ]

    HOME BUTTON:

    HC2 = Net.FHttp("192.168.0.8",80);

    HC2:setBasicAuthentication("idontthinkso", "hahaha");

    local payload = '{"id": 2, "tracking": 60}';

    response ,status, errorCode = HC2:PUT("/api/users", payload);

    if tonumber(status) == 200 then

    fibaro:debug("GPS was set to = 60");

    fibaro:setGlobal("MICKEYMOUSE", "HOME");

    fibaro:call(154, "setProperty", "ui.Label1.value", "HOME");

    fibaro:call(153, "pressButton", "16");

    else

    fibaro:debug("Status = "..status);

    fibaro:debug("Error code = "..errorCode);

    end

    [ Added: 2014-07-14, 22:31 ]

    AWAY BUTTON:

    HC2 = Net.FHttp("192.168.0.8",80);

    HC2:setBasicAuthentication("idonthtinkso", "hahahaha");

    local payload = '{"id": 2, "tracking": 1}';

    response ,status, errorCode = HC2:PUT("/api/users", payload);

    if tonumber(status) == 200 then

    fibaro:debug("GPS was set to = 1");

    fibaro:setGlobal("MICKEYMOUSE", "AWAY");

    fibaro:call(154, "setProperty", "ui.Label1.value", "AWAY");

    fibaro:call(153, "pressButton", "17");

    else

    fibaro:debug("Status = "..status);

    fibaro:debug("Error code = "..errorCode);

    end

    [ Added: 2014-07-14, 22:32 ]

    good luck with the ping... afaik ios blocked it early 6.x and android the same in jellybean... the tcp ports are now blocked you would need

    Deanrparry,

    For this script to work, you are using a vpn ?

    I cannot understand how your trigger app is working from your work ?

    Thanks !

    Link to comment
    Share on other sites

    • 0

    Afaik the idea is to 'ping' your mobile over wifi. When this 'ping' indeed works, which is when your device is on wifi, you know the device (and most of the time the person who owns it) is around. When the 'ping' fails, the device is away.

    I don't see how a VPN is involved, there's nothing working from 'at work', except for the fact that the 'ping' fails, and HC2 knows the device is away.

    By the way, I ping my devices from my Synology Diskstation, and use arp to check if it's around. Depending on this a php page is created or deleted, which the HC2 checks on. My point is, iOS devices are pingable, if you use real pings.

    Link to comment
    Share on other sites

    • 0
    I use trigger android app to start a scene on hc2 when wifi is connected and again to start a scene when wifi is disconnected!

    I'd rather to use ping or to check for mac address (because of my girlfriend who does not have android), but this looks like a good idea!

    I use Tasker.

    Which command do you use to start a scene or to push a buttond on a virtual device?

    Thanks

    http:///api/callAction?deviceID=15&name=pressButton&arg1=2

    [ Added: 2014-07-14, 22:30 ]

    HOME BUTTON:

    HC2 = Net.FHttp("192.168.0.8",80);

    HC2:setBasicAuthentication("idontthinkso", "hahaha");

    local payload = '{"id": 2, "tracking": 60}';

    response ,status, errorCode = HC2:PUT("/api/users", payload);

    if tonumber(status) == 200 then

    fibaro:debug("GPS was set to = 60");

    fibaro:setGlobal("MICKEYMOUSE", "HOME");

    fibaro:call(154, "setProperty", "ui.Label1.value", "HOME");

    fibaro:call(153, "pressButton", "16");

    else

    fibaro:debug("Status = "..status);

    fibaro:debug("Error code = "..errorCode);

    end

    [ Added: 2014-07-14, 22:31 ]

    AWAY BUTTON:

    HC2 = Net.FHttp("192.168.0.8",80);

    HC2:setBasicAuthentication("idonthtinkso", "hahahaha");

    local payload = '{"id": 2, "tracking": 1}';

    response ,status, errorCode = HC2:PUT("/api/users", payload);

    if tonumber(status) == 200 then

    fibaro:debug("GPS was set to = 1");

    fibaro:setGlobal("MICKEYMOUSE", "AWAY");

    fibaro:call(154, "setProperty", "ui.Label1.value", "AWAY");

    fibaro:call(153, "pressButton", "17");

    else

    fibaro:debug("Status = "..status);

    fibaro:debug("Error code = "..errorCode);

    end

    [ Added: 2014-07-14, 22:32 ]

    good luck with the ping... afaik ios blocked it early 6.x and android the same in jellybean... the tcp ports are now blocked you would need

    Deanrparry,

    For this script to work, you are using a vpn ?

    I cannot understand how your trigger app is working from your work ?

    Thanks !

    the url

    http:///api/callAction?deviceID=15&name=pressButton&arg1=2

    is used in trigger app to press button 1 HOME or button 2 AWAY

    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" />

    hope that helps!

    Link to comment
    Share on other sites

    • 0

    Understood that, but, from work, you cannot acces your hc2 192.168.x.x address ? only trough a vpn.

    Or maybe you have your HC2 opened on internet trough your router ?

    Link to comment
    Share on other sites

    • 0

    I believe it's an automated process. Loops are not working that great is what I understood, so the URL you refer to is used in a scene. The scene does the button pressing.

    Something like this: when the phone is detected on the wifi network, a global variable is set, which triggers a scene that presses a button on a virtual device, which starts the magic.

    I have a scene that presses buttons on a virtual device, with regular interval. Each button checks if a mobile device is reachable on local wifi. If it is, it sets a global variable for that device (owner of the device is home, or when device is not reachable, away)

    I have scenes that are triggered by the global variables, that perform an action when the global variable changes. If I get home, the global variable value changes, and that scene is executed. For now it only sends me notifications, so I can check if the code works ok. I believe the code in this post works in a similar way. It's not like when you're at work you manually have to access the url to set things in motion.

    Link to comment
    Share on other sites

    • 0
    On 7/15/2014 at 2:24 AM, boerremk said:

    I have a virtual device that logon to my Unifi (Wifi AP) controller to see if the phones of the family members are online. Some scenes depends on the status of that virtual device (lights, alarm, etc).

    Is it possible to get a copy of this VD?

    Link to comment
    Share on other sites

    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...