Anyone using a IP script to geofence? I can't get mine to work.

Joined
Jan 19, 2018
Messages
12
Reaction score
3
Anyone using a IP script to geofence? I can't get mine to work.

Code:
Set wshShell = CreateObject("WScript.Shell")

Set IE = CreateObject("InternetExplorer.Application")
Set WshShell = WScript.CreateObject("WScript.Shell")

daniel = "192.168.1.7"
elana = "192.168.1.8"

someoneishome = "http://192.168.1.5:81/admin?profile=1"
nooneishome = "http://192.168.1.5:81/admin?profile=2"

'Run the ping program 3 times, with a 2000ms delay on each, 0 = don't display cmd prompt
'All three pings must be successful for CBool = true

WScript.Sleep 90000

isdanielhome = Not CBool(wshShell.run("ping -n 3 -w 900  " & daniel,0,True))
iselanahome = Not CBool(wshShell.run("ping -n 3 -w 900  " & elana,0,True))


If isdanielhome = True or iselanahome = True Then

    IE.Navigate "http://192.168.1.5:81/admin?profile=1"

Else

    IE.Navigate "http://192.168.1.5:81/admin?profile=2"

End If

'Release memory
Set wshShell = Nothing
 

fenderman

Staff member
Joined
Mar 9, 2014
Messages
36,902
Reaction score
21,274
There is a thread pointing to a youtube video with instructions..
 

Vettester

Getting comfortable
Joined
Feb 5, 2017
Messages
743
Reaction score
698
The geofencing option in BI seems to be working well on my iPhone 7.
 
Joined
Jan 19, 2018
Messages
12
Reaction score
3
Got it working with a python script. Posting the solution bc that youtube video tells you jack.


Installed python on windows. Linked python.exe. Parameters is location of the python script.

If its not working check:
1. make sure the service is running via admin
2. Webserver -> Advanced -> uncheck "Use secure session keys and login page

So I have to disable secure session to allow the below urls to change the profile? Is there any other option? BI should NOT? be accessed via the web only vpn?

Code:
import subprocess
import time
import urllib.request

time.sleep(6)

hostname = "192.168.1.7"
output = subprocess.Popen(["ping.exe",hostname],stdout = subprocess.PIPE).communicate()[0]

hostname2 = "192.168.1.8"
output2 = subprocess.Popen(["ping.exe",hostname2],stdout = subprocess.PIPE).communicate()[0]

if b'unreachable' in output:
    if b'unreachable' in output2:
        urllib.request.urlopen("http://192.168.1.5:81/admin?profile=2&user=USERNAME&pw=PW")
    else:
        urllib.request.urlopen("http://192.168.1.5:81/admin?profile=1&user=USERNAME&pw=PW")   
else:
    urllib.request.urlopen("http://192.168.1.5:81/admin?profile=1&user=USERNAME&pw=PW")
 
Top