python-amcrest
python-amcrest copied to clipboard
Support for ASH21
Can this be supported? It has an RTSP stream, I don't know if it needs more for the PTZ functionality but it would be nice to see this one work.
Looking at the home assistant integration ticket that is tagged above, it doesn't look like the ASH21 is capable of using the Amcrest API. Do you have a device to test on? Does it give similar results as the home assistant ticket when you try to connect to it?
@flacjacket I do not believe ASH21 does support the api, this is a log from my HA install
Sep 4 12:45:44 ha 0eb83eaffa52[1069]: 2021-09-04 12:45:44 WARNING (SyncWorker_2) [amcrest.http] <Unconnected @ 192.168.XX.XXX> Trying again due to error: HTTPError('404 Client Error: Not Found for url: http://192.168.XX.XXX:80/cgi-bin/magicBox.cgi?action=getMachineName')
Rtsp stream does work on
rtsp://user:[email protected]/cam/realmonitor?channel=1&subtype=1
Is there any way to add support w/out the api? My use case is to add it to home assistant and then publish it to homekit
@rob121 Yes, you can use the rtsp stream directly in home assistant through the ffmpeg integration, where the input
is the rtsp stream url. One thing that does not supply, which the amcrest integration is able to with the .snapshot
API, is a fast loading preview image. Can you test if you can get a snapshot back? If so, there may be something that could be setup to get a lightweight camera-only entity in home assistant. You can check by doing:
from amcrest import AmcrestCamera
camera = AmcrestCamera(host, 80, user, password).camera
camera.snapshot(stream=False)
@flacjacket It doesn't appear that the ASH21 supports the snapshot api, the AD110 didn't either but a later firmware update did at it, so there is hope maybe.
The only option for getting a snapshot was something like this via ffmpeg:
ffmpeg -y -i "rtsp://user:[email protected]/cam/realmonitor?channel=1&subtype=1" -vsync 2 -vframes 1 snapshot.jpg
I can do it via ffmpeg as you say, but since amcrest seems to be inconsistent on some of their cameras it would be nice to have a "fallback mode" that just gives you the basics of a snapshot and rtsp stream via ffmpeg.
any movement here? the interesting piece is that you can connect the ASH camera to the amcrest app, not the smart home one, and you can control it. So how are they connecting it? it has to have some sort of API. thoughts?
Curious about this too. Since the Amcrest Smart Home app can control it, there must be some kind of API it uses. I'll see if I can sniff the protocol, but it won't be in the next few weeks.
FWIW, I am using BlueIris, and that can control the ASH cameras PTZ
@arthurnn do you have any information on the protocol it might be using in Blue Iris?
Actually, I've done more homework: If it works with Blue Iris it should have an RTSP stream. ONVIF is used e.g. for PTZ and can be sent over RTSP (I thought ONVIF was its own communication protocol). So, I think my statement then becomes: If the camera will respond to ONVIF over RTSP, then one should be able to use any ONVIF library. That's probably why Blue Iris works.