I have an Axis IP camera which has an integrated PIR sensor. I can configure the camera to send a HTTP or TCP notification when it senses movement. I noticed Home Assistant has a HTTP sensor as well as TCP sensor. However the HTTP sensor expects JSON which the camera doesn’t post and the TCP sensor is for polling, not for receiving notifications on its own. Has anyone tried to get something like this to work?
You could create a script that you call via HTTP. I’m not sure that you’d be able to pass/receive arguments, but you could have the script notify you with a “motion sensed” message. Then turn on some lights based on time-of-day, etc.
Note: you can add conditions to the sequence of a script. The script continues as long as the condition is met.
Good idea, thanks. I don’t think I need to pass arguments anyway. Installing a WWW server just for this seems a bit excessive, but I guess there aren’t much of a choice.
I’m also looking at integrating various Axis cameras with HASS and have been looking into the possible ways, @ih8gates seems to have some good suggestions. Hope this will work for us!
I made a script and tried to call it with http://myhassip/api/services/script/test1?api_password=123456789 but I’m getting “405: Method Not Allowed”. Same message from curl and browser. The script is working through the services dev tool. Tried the following curl command per the example here:
Oops. Changed GET to POST in the curl command and now it works. Axis doesn’t trigger the script though. It does accept the address and test says succesfull, so maybe it doesn’t just use POST after all. I’ll maybe do a packet capture later to confirm.
edit: Axis uses GET on its request, so it looks like this approach might not work. If all else fails, installing that web server should solve the problem.
I saw that with latest release Hikvision got support for their event stream, Axis has got something similar, so would be interesting to see if it owould be possible to achieve a similar implementation.
Not sure if you got this sorted in the end. We install Axis equipment and integrate with 3rd party systems. The VAPIX document maybe of some help to you. Axis VAPIX Events There is also other VAPIX documentation available at All VAPIX Documents
You can also have TCP notifications rather than HTTP, im fairly new to HA so im not sure what options are avaialble.
HTTP API: you can read the PIR state from /axis-cgi/view/param.cgi?action=list&group=IOPort.I0.Input.Trig. However this would require polling and the PIR seems to activate for only a very short time so this will not work.
Axis scripting: couldn’t find a suitable command to do a HTTP GET.
So far the only thing I can think of that would work is to use 3rd party web server.
Where cleaning up my mailbox and found this old thread and thought I would just post a link to my custom component that gives support for among other things Axis cameras with pir sensor.