I purchased and installed several Amcrest ASH26-W Floodlight Cameras and successfully incorporated into Home Assistant with generic camera and the Dahua integration in HACS. The issue I’m having is that when the light control is set to motion activated, the switch just briefly flashes the light on. There is also no option to control the siren.
If I put the url directly into chrome, I get an ok response and the desired action occurs. It seems like the user id and pw is not being passed along when included in the url. I tried to play around with other rest options with the same result:
It seems like since the url works, I’m having an issue with how to set up the rest command. I’m posing this to hopefully get this resolved but also to help others using this same unit out. I like to be able to control everything in Home Assistant and not having to go into a bunch of other apps.
Good point but still I get the same error with GET or POST. I’d also think that since I’m sending data and not retreiving data POST would be correct. 401 Error makes me think there is something wrong with the authentication when using REST even though the url works directly.
You’re trying to use Basic Auth and the API does not support that. You want to use Digest Auth which is slightly more involved but it looks like Home Assistant makes it easy.
This getstatus API is not working for me. Getting 400 / Bad Request. /cgi-bin/coaxialControlIO.cgi?action=getstatus
But these seem to work
Light on: /cgi-bin/coaxialControlIO.cgi?action=control&channel=1&info[0].Type=1&info[0].IO=1
Light off: /cgi-bin/coaxialControlIO.cgi?action=control&channel=1&info[0].Type=1&info[0].IO=0
Siren on: /cgi-bin/coaxialControlIO.cgiaction=control&channel=1&info[0].Type=2&info[0].IO=1
Siren off: /cgi-bin/coaxialControlIO.cgi?action=control&channel=1&info[0].Type=2&info[0].IO=2
(IO=2 is the correct string to turn off the siren.)
EDIT: The method is GET btw for all API requests. Not POST
I started writing this and forgot to hit post 2 weeks ago:
Ok, after a bunch of github searching, I finally got something that works. I ended up having to use a shell command, which is not ideal as it requires restarts after each change to test. Maybe there’s a way to get this to work in REST?