Using a Panasonic BL-C131A to update a Variable

Posted on
Fri Dec 31, 2010 3:29 pm
dstrickler offline
User avatar
Posts: 340
Joined: Oct 08, 2010
Location: Boston, MA

Using a Panasonic BL-C131A to update a Variable

I am using the BL-C131A with it's HTTP on Sensor trigger to try and use the Rest API in Indigo

When I put all the URL in the browser, it works just fine, but when I use BL-C131A, the error I get in Indigo in the log is
WebServer access denied "http://10.0.1.12/variables/isMotionFrontDoor" from dstrickler @ 10.0.1.13


I can't tell if this is a password that's bad (I've tried working around that) or a bad variable name (I've cut and pasted it), or something else.

Can anyone let me know more about this error when using the Rest API? In the example above, I am trying to set the "isMotionFrontDoor" to "true".

TIA,

Dave

Posted on
Fri Dec 31, 2010 4:22 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Using a Panasonic BL-C131A to update a Variable

How are you trying to pass the user name / password to the Indigo Web Server? Try turning off the authentication totally (inside the Start Local Server dialog). If it then works, then you know for sure the password is the problem.

Image

Posted on
Fri Dec 31, 2010 4:47 pm
dstrickler offline
User avatar
Posts: 340
Joined: Oct 08, 2010
Location: Boston, MA

Re: Using a Panasonic BL-C131A to update a Variable

(Doh!) Rookie move - sorry...

I removed the user/pass from Indigo and from the BL-C131A's HTTP trigger, and it worked perfectly.

Now it leaves the question, why doesn't it accept the user/pass from the BL-C131A's HTTP trigger. Very strange. I will experiment more and leave my findings in this thread.

Thanks for your help

Dave

Posted on
Fri Dec 31, 2010 4:59 pm
dstrickler offline
User avatar
Posts: 340
Joined: Oct 08, 2010
Location: Boston, MA

Re: Using a Panasonic BL-C131A to update a Variable

Final testing shows that the user/pass put into the camera's fields are not being accepted by Indigo. No matter what I set the Indigo password to, the camera won't talk to it with the HTTP user/pass in it. I am convinced this is a camera issue, and not Indigo.

Too bad, as it would make a "no script" solution for getting the camera to talk to Indigo. :|

Dave

Posted on
Sat Jan 01, 2011 10:58 am
CharlieParker offline
Posts: 241
Joined: Apr 10, 2006
Location: Lower Hudson Valley

Re: Using a Panasonic BL-C131A to update a Variable

Did you try putting the user & password in the URL? http://user:password@10.0.1.12/

Posted on
Sat Jan 01, 2011 11:16 am
dstrickler offline
User avatar
Posts: 340
Joined: Oct 08, 2010
Location: Boston, MA

Re: Using a Panasonic BL-C131A to update a Variable

CharlieParker wrote:
Did you try putting the user & password in the URL? http://user:password@10.0.1.12/


Yes, I tried that as well. There is a field for the user/pass combo, but I even tried leaving it blank and passing in on the URL as in your example above, but that didn't work. My guess is that it's a bug in the camera's firmware, and I am going to see if I can code around it.

Too bad you can't tell Indigo to not require a password from an IP address...

Dave

Posted on
Sat Jan 01, 2011 12:01 pm
dstrickler offline
User avatar
Posts: 340
Joined: Oct 08, 2010
Location: Boston, MA

Re: Using a Panasonic BL-C131A to update a Variable

The plot thickens... I am now trying curl from the CLI
Code: Select all
DStricklerMBP:indigo dstrickler$ curl -X PUT -u user:password -d value=true http://10.0.1.12:8176/variables/isMotionFrontDoor
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
   <head>
      <title>Indigo Home Control Server</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <link rel="stylesheet" media="screen" type="text/css" href="/css/global4.css" />
      <link rel="stylesheet" media="screen" type="text/css" href="/css/indigo4.css" />
   </head>
   <body>
      <center>
   access denied
      </center>
   </body>
</html>


Note the Access Denied. Same as the camera was getting. Perhaps this *is* something I have buggered up in Indigo...

Dave

Posted on
Sat Jan 01, 2011 12:14 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Using a Panasonic BL-C131A to update a Variable

When using curl, pass the --digest flag. IndigoWebServer by default uses digest HTTP authentication (not clear-text basic authentication). You can via a config file force the Indigo Web Server to always use basic authentication, but I only recommend that if you will always be using HTTPS to avoid having the password send as clear text:

viewtopic.php?f=8&t=1590

Image

Posted on
Sat Jan 01, 2011 12:53 pm
dstrickler offline
User avatar
Posts: 340
Joined: Oct 08, 2010
Location: Boston, MA

Re: Using a Panasonic BL-C131A to update a Variable

support wrote:
When using curl, pass the --digest flag. IndigoWebServer by default uses digest HTTP authentication (not clear-text basic authentication). You can via a config file force the Indigo Web Server to always use basic authentication, but I only recommend that if you will always be using HTTPS to avoid having the password send as clear text:

viewtopic.php?f=8&t=1590


That did it - THANKS!

I am 99% sure that's why the camera authentication didn't work. While I love the camera, it's primitive in some ways, and doesn't allow for any encryption when using this HTTP trigger method. Going forward, this is a good tip to have on your Rest API examples page.

For anyone following this thread that wants a hack to solve this, I turned on the Apache web server on my Mac that's running Indigo, and made a small PHP script that does the CURL command for me.
Code: Select all
<?PHP
$var_name = $_GET['name'] ;
$var_value = $_GET['value'] ;
$curl_cli = "curl -X PUT --digest -u username:password -d value=$var_value http://10.0.1.12:8176/variables/$var_name" ;
system($curl_cli) ;


So I have the camera call out it's HTTP trigger to port 80, which runs this script. Then this script calls CURL from the CLI and passes the correct params to Indigo, using the digest method on passwords as indicated by Support.

The result is that my the BL-C131A camera can now sense motion at my front door and change a variable to TRUE in Indigo, indicating so. When that Indigo trigger happens, another Indigo trigger happens that's delayed by 1min which sets the variable back to FALSE. The result is that the camera sees movement, sets the variable to TRUE, and in 1min, the variable is set back to FALSE, assuming the camera doesn't keep setting it back to TRUE due to more movement.

Now I don't need an extra motion sensor at my front door. The camera works with Indigo to turn on the front door light, and records 1m of video, just in case I want to see who was there (Mailman with a package, etc).

Wahoo!

Dave

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests