Page 1 of 1

http action group for external app?

PostPosted: Fri Dec 29, 2017 8:25 am
by Seeker
Using homeremote's geo feature, i'd like to trigger a change of the blue iris camera app (on another PC) when the geo enters/exits.

what's the best way to add an indigo action group to execute the following?

Code: Select all
change blue iris to profile 1
http://192.168.2.100:8000/admin?user=USER&pw=PASSWORD&profile=1


I tried adding the command to a python script action, but it gives a syntax error.

thanks

Re: http action group for external app?

PostPosted: Fri Dec 29, 2017 9:28 am
by Different Computers
If I understand what you're trying to do, can't you create a shell script containing a curl command and have the action group execute that?

Re: http action group for external app?

PostPosted: Fri Dec 29, 2017 9:46 am
by jay (support)
This Python script should do the trick (Indigo 7+ required):

Code: Select all
import requests
requests.get("http://192.168.2.100:8000/admin?user=USER&pw=PASSWORD&profile=1")

Re: http action group for external app?

PostPosted: Fri Dec 29, 2017 3:51 pm
by Seeker
i simply want to have an action group that emulates me manually entering:

Code: Select all
http://192.168.2.100:8000/admin?user=USER&pw=PASSWORD&profile=1


into a browser. that command changes blue iris's profile.

i tried:

Code: Select all
import urllib2
urllib2.urlopen("http://192.168.2.100:8000/admin?user=USER&pw=PASSWORD&profile=1")


but that does not change the profile. manually entering the address into safari does.

Re: http action group for external app?

PostPosted: Fri Dec 29, 2017 4:38 pm
by jay (support)
Did you try my version of that script? I'm quite surprised that your script didn't work - they are functionally equal. I wonder if your browser has some username/password cached? That would cause the browser to automatically send the basic or digest HTTP authentication information. Try a different browser and see if the URL works there as well.

Re: http action group for external app?

PostPosted: Fri Dec 29, 2017 4:47 pm
by Seeker
sorry, Jay, i missed your response!

I tried your code in a python script action group, hit execute while monitoring the BI control page and there is no change to the profile. copy/paste the http:... to safari and hit enter and the profile changes. note that when i use safari I get this returned on the page:

signal=green
profile=1
lock=1


thanks for any suggestions.

Re: http action group for external app?

PostPosted: Fri Dec 29, 2017 4:58 pm
by jay (support)
Did you try another browser as I suggested to make sure Safari isn't using cached authentication data?

Re: http action group for external app?

PostPosted: Fri Dec 29, 2017 6:04 pm
by Seeker
jay, you are correct. i tried it in chrome and i get 'authentication required'. let me play with the command.