http relay activate with username and password authentication
-
Hi to all,
I am user of vera controller. I have a dahua door intercom with relay. Relay activates with username and password authentication. I can activate the relayhttp://admin:a1234567@192.168.1.111/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote
As you can see intercom username
admin
and password isa1234567
I build a scene with luup codeluup.inet.wget( "http://admin:a1234567@192.168.1.111/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote" )
But can not activate relay. Is there any idea? -
Try using:
luup.inet.wget( "http://192.168.1.111/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote", 15, "admin", "a1234567" )
...and see if that works (username and password as third and fourth arguments). If not, your door intercom probably requires Digest Authentication, which the browser will happily use if asked, but which the old libraries on Vera probably don't do. In that case, you'll want to use
curl
viaos.execute()
like this:os.execute( "curl -o - --user admin:a1234567 'http://192.168.1.111/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote'")
Notice that the URL is enclosed in single-quotes, which is necessary; the entire command is enclosed in double quotes. The closing single quote at the end of the URL is next to the closing double quote for the string sent to
os.execute()
so it is hard to see, but it's there. -
Try using:
luup.inet.wget( "http://192.168.1.111/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote", 15, "admin", "a1234567" )
...and see if that works (username and password as third and fourth arguments). If not, your door intercom probably requires Digest Authentication, which the browser will happily use if asked, but which the old libraries on Vera probably don't do. In that case, you'll want to use
curl
viaos.execute()
like this:os.execute( "curl -o - --user admin:a1234567 'http://192.168.1.111/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote'")
Notice that the URL is enclosed in single-quotes, which is necessary; the entire command is enclosed in double quotes. The closing single quote at the end of the URL is next to the closing double quote for the string sent to
os.execute()
so it is hard to see, but it's there.@toggledbits said in http relay activate with username and password authentication:
os.execute( "curl -o - --user admin:a1234567 'http://192.168.1.111/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote'")
Thanks for reply but both are not working.
-
@toggledbits said in http relay activate with username and password authentication:
os.execute( "curl -o - --user admin:a1234567 'http://192.168.1.111/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote'")
Thanks for reply but both are not working.
@destination what if you just try that curl command from the command line (without os.execute)? Just to narrow down what is working and what's not.
-
@destination what if you just try that curl command from the command line (without os.execute)? Just to narrow down what is working and what's not.
@tunnus said in http relay activate with username and password authentication:
@destination what if you just try that curl command from the command line (without os.execute)? Just to narrow down what is working and what's not.
No luck