mac-add detect

any help,i want to monitor mac-add connected on wifi, and according to that i want to get email notifications, whether is connected or not

i was watching:

https://www.youtube.com/watch?v=4TVbQcRxmH0&t=21s

and i have edit:


when the device is conected–> WORK!

/tool e-mail send to=“> myemail@gmail.com> " from=”> myemail@gmail.com> " subject=test body=“$wife home!”;

when the devie is not connected doese’t work!

/tool e-mail send to=“> myemail@gmail.com> " from=”> myemail@gmail.com> " subject=test body=“$wife gone!”;

Post YOUR script here and use the correct forum section every time, I only noticed this topic by accident…

since u respond i’m saved

:local wifedetected false
:while (true) do={
       :do {
             :local detect ([/caps-man/registration-table/get [find where mac-address=AC:D1:B8:84:F5:23]])
              :if (([:len $detect]) > 0) do={
                   :if ($wifedetected = false) do={
                        :put "wife home!"
                        /tool e-mail send to="myemail@gmail.com" from="myemail@gmail.com"  subject=test  body="$wife home!";
                        :set wifedetected  true
                        }
              }
        } on-error={
           :if ($wifedetected = true) do={
                :put "wife gone!"
                /tool e-mail send to="myemail@gmail.com" from="myemail@gmail.com"  subject=test  body="$wife gone!";
                :set wifedetected false
           }
        }
         :delay 1
}

What? In what sense?


1 second for me is excessive, I set it to 60 seconds, is more logical that continuosly check, and also if for some reason disconnect and reconnect shortly, do not sent uselessly 2 emails…
:local MAC “AC:D1:B8:84:F5:23”
:local MACdetected [:nothing]
:local findMAC [:nothing]

:while (true) do={
:set findMAC [/caps-man registration-table find where mac-address=$MAC]
:if ([:len $findMAC] > 0) do={
:if ($MACdetected != true) do={
:log info “$MAC Detected!”
/tool e-mail send to=“myemail@gmail.com” from=“myemail@gmail.com” subject=test body=“$MAC Detected!”
:set MACdetected true
}
} else={
:if ($MACdetected != false) do={
:log info “$MAC Gone!”
/tool e-mail send to=“myemail@gmail.com” from=“myemail@gmail.com” subject=test body=“$MAC Gone!”
:set MACdetected false
}
}
:delay 60s
}

@rextended

Thanks a lot!!