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


Idea how to monitor people at home


Recommended Posts

Guest Roman
  • Topic Author
  • Posted

    127.0.0.1 - is IP address of your Fibaro HC2. You don't need to change it because this is internal IP. It's always 127.0.0.1

     

    You just need to change variable with MAC address of device, which you want to find in home network.

    For example this is MAC address of your mobile phone.
    So this script will be able to scan your net and try to find your phone.

    Result will be saved to global variable. And this variable could be used in different scenes.

    • 3 weeks later...
    Posted

    can't get it to work

    i have a asus RT-N66U router

    mac is 00:24:01:CB:D6:02

               48:5A:3F:6D:95:F4

     

    got two android phones neither works

     

    what am i doing rong??

    Guest Roman
  • Topic Author
  • Posted

    Could you try to change lower case your this address:

     

    00:24:01:CB:D6:02

    to

    00:24:01:cb:d6:02

    Posted

    this will change status when the arp discovery is reset i think so you will get false readings of false even though you are still connected?

    Posted

    Yep that's it. Thanks man.

    • 1 year later...
    Posted
    On 3/17/2016 at 6:03 PM, marton said:

    Sure! It works with iPhones, we have two and no problem! So I run a script every minute to check if the phones are home or not. It updates a database and also runs a scene in HCL. In the database I store the bluetooth mac addresses of the phones and their static ip addresses. I set it up in my router so that the phones get the same ip address every time. With this I just add another line in the database and I can check 3 phones, and so on.

     

    I am using a file to store if someone was home, so I won't update the HCL every minute, just when a change happens.

     

     

    Here is the script, but please forgive me for any coding nonsense as I have very-very little knowledge about how to code. However this works

    Please login or register to see this image.

    /emoticons/default_smile.png" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" data-emoticon="" />

     

     

    #/bin/bash

    file="/home/pi/yes"
    anybody_home=0
    date=$(date +"%H:%M");
     
    #check if someone was already home
    filecheck=$([ -f $file ])$?
     
    while read -a row
    do
        #echo "${row[0]} ${row[1]} ${row[2]} ${row[3]} ${row[4]}"
        #check for bluetooth and ping
        btcheck=$(hcitool name "${row[3]}" | grep -q "${row[0]}")$?
        ping=$(ping -q -c1 "${row[4]}" > /dev/null 2>&1)$?
        #echo "btcheck: $btcheck  ping: $ping"
        #someone is home but was not before
        if [ $btcheck = 0 ] || [ $ping = 0 ]
          then
          echo "${row[0]} is home"
          anybody_home=1
          if [ "${row[1]}" = "no" ]
            then
             mysql --user="user" --password="pass" --database="home_automation" --execute="UPDATE anybody_home SET ishome='yes', date='$date' WHERE who='${row[0]}';";
          fi
        fi
        #someone was home, but not anymore
        if [ $btcheck = 1 ] && [ $ping = 1 ] && [ "${row[1]}" = "yes" ]
          then
          echo "${row[0]} is away but was home before"
          mysql --user="user" --password="pass" --database="home_automation" --execute="UPDATE anybody_home SET ishome='no', date='0' WHERE who='${row[0]}';";
        fi
    done < <(echo "SELECT * FROM anybody_home" | mysql --database="home_automation" --user="user" --password="pass")
     
    echo "Anybody home: $anybody_home"
     
    if [ $anybody_home = 1 ] && [ $filecheck = 1 ]
    then
     #someone is home, but not before, updating fibaro
     echo "someone is home, but not before, updating fibaro"
     curl -G "

    Please login or register to see this link.

     touch $file
    fi
     
    if [ $anybody_home = 0 ] && [ $filecheck = 0 ]
    then
     #someone was home, but left, updating fibaro
     echo "someone was home, but left, updating fibaro"
     curl -G "

    Please login or register to see this link.

     rm -f $file
    fi

    @marton

     

    do you have a video or specific instructions on how to set this up? anything would be great! thanks

    Posted

    Hi @Roman

    Im new to Home center and not sure how to make this work 

     

    i have tried making a new virtual device then added a button then added your code but nothing happens 

     

    went into the debug then hit start and nothing ether 

     

    what am i missing 

     

    Thanks For any help 

    • 10 months later...
    Posted

    Have copyed your code, placed it into a scene and changed the mac address.

    Have also created a variable called UserAtHome

     

    But I an only getting the error:

     

    [DEBUG] 14:03:56: [1;31m2018-08-07 14:03:56.977862 [ fatal] Unknown exception: /opt/fibaro/scenes/113.lua:8: attempt to index global 'Net' (a nil value)

     

    Line 8 is: 

    Please login or register to see this code.

     

    Join the conversation

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

    Guest
    Reply to this topic...

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