[SOLVED] Axis camera http trigger rule

Hi,

I can trigger virtual input via browser line:
SET INPUT
http://192.168.100.9/axis-cgi/virtualinput/activate.cgi?schemaversion=1&port=1

RESET INPUT
http://192.168.100.9/axis-cgi/virtualinput/deactivate.cgi?schemaversion=1&port=1

I would like to use this in a rule (item JA65 is a contact)
rule “ALARM ARMED ON”
when
Item JA65_Home changed from CLOSED to OPEN
then
sendHttpGetRequest(“http://192.168.100.9:80/axis-cgi/virtualinput/activate.cgi?schemaversion=1&port=1”)
sendMail(“jozef.szabo@email.cz”, “Home ON”, “OpenHAB2.”)
end

rule “ALARM ARMED OFF”
when
Item JA65_Home changed from OPEN to CLOSED
then
sendHttpGetRequest(“http://192.168.100.9:80/axis-cgi/virtualinput/deactivate.cgi?schemaversion=1&port=1”)
sendMail(“jozef.szabo@email.cz”, “Home OFF”, “OpenHAB2.”)
end

Email are sending correctly, but the http request is not working.
Get, Put, Post … nothing OK
Request should set/reset virtual input 1 of the camera.
Any suggestion ?
Thanks.

Try setting the HTTP binding to debug and see what comes up in the log. Maybe a permissions issue?

Thanks,
Is this correct for DEBUG for http binding ?

  1. Open with Putty SSH connection OH2IP Port:22, user:pi pw:mypw
  2. sudo su
  3. ssh -p 8101 openhab@localhost PW:habopen
  4. log:set DEBUG org.openhab.binding.http
  5. log:list shows org.openhab.binding.http | DEBUG
  6. log:display or log:tail

Camera access is password protected. Is it necessary to insert user and pw to the sendhttp ?
http://user:pw@192.168.100.9:80/axis-cgi/virtualinput/activate.cgi?schemaversion=1&port=1

On DEBUG I can`t see lines according Axis statement

After lot of testing I can use http statements directly via browser input
Camera event is triggered via virtual input 1 from windows firefox and pri firefox

Set virtual input 1:
http://AxisIP/axis-cgi/virtualinput/activate.cgi?schemaversion=1&port=1

Reset virtual input 1:
http://AxisIP/axis-cgi/virtualinput/deactivate.cgi?schemaversion=1&port=1

But above rules without success :0(
Also tested on received command with ON/OFF case

curl on RPI3 Raspbian
root@raspberrypi:/home/pi# curl http://192.168.100.9/axis-cgi/virtualinput/activate.cgi?schemaversion=1&port=1
root@raspberrypi:/home/pi#
Unauthorized
This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn’t understand how to supply
the credentials required

Also same if I put valid user:password before IP

Maybe a openhab script would be better. Can someone me help with script ?
Thanks for help.

This solves my CURL problem. No ’ single quotas and all spaces to @@ and --anyauth (avoid authorisation problem)
curl statement should be as a string without spaces and ’

executeCommandLine("curl@@--anyauth@@-u@@root:pw@@http://192.168.100.9:80/axis-cgi/virtualinput/activate.cgi?schemaversion=1&port=1")

On Axis cameras FW>5.50 are virtual inputs 1-32 as event trigger possible.

Hi,
anybody knows how is possible to get info about motion detection status (not stream, picture) to set some flag and switch some rule with this flag (switch) ?