rroller / dahua

Dahua Camera and Doorbell Home Assistant Integration
MIT License
377 stars 73 forks source link

Add support for PTZ #42

Open MiAutomations opened 3 years ago

MiAutomations commented 3 years ago

Hello and thank you for your work with this costume component !!

Just to share with you that I have tested successfully this models:

IPC-HFW1230S https://s.click.aliexpress.com/e/_AaZ6Mt IMOU IPC-K22A / Cube PoE-322A https://s.click.aliexpress.com/e/_AotOJr IMOU IPC-A26Z / Ranger Pro Z https://s.click.aliexpress.com/e/_9xkY6V

And i also have a request to improve this, can you please add the PTZ commands to the models that support this feature please like this one Please if possible at right a saved position and a left the commands to move the cameras

image

Thank you and best regards

rroller commented 3 years ago

Awesome, thank you! It's so weird that some IMOU's work and some don't. Interesting that you have two that work.

I will def add the PTZ. It's a little hard since I don't have a PTZ camera yet. I'm going to order one so I can easily add the PTZ. I'll edit the title of this issue and keep it open to track PTZ support. Thanks again!

GaryOkie commented 2 years ago

Hi Ronnie/@rroller - I just this morning discovered this integration exists from an ipcamtalk reference. Great work! I've been trying to make do with the Amcrest integration for Dahua cameras for a long time, along with the amcrest2mqtt to handle events. It's so much better to have event handling integrated.

My first code contribution to HA was adding PTZ support to the Amcrest integration. if it helps, just refer to the source https://github.com/home-assistant/core/blob/dev/homeassistant/components/amcrest/camera.py and search for "ptz".

The documentation for the PTZ services : https://www.home-assistant.io/integrations/amcrest/#service-ptz_control

I'll get started today installing your custom integration and will be happy to start help testing.

rroller commented 2 years ago

@GaryOkie wow that's awesome, thank you! Testing would be great since I don't have a PTZ camera. I'll try to add support for this soon.

MiAutomations commented 2 years ago

@GaryOkie grate work and thank you for sharing!!

But i think that some of models from Dahua/Imou doesn't support the ONVIF commands for the PTZ movements. I have 2 models that I can't move using the HA service ONVIF PTZ, and I don't understand why ...

But the same code changing the device ID I'm abale to move other camera brands/models

Perhaps the api commands are in my option the best way...

cheers

GaryOkie commented 2 years ago

The PTZ service code I contributed to HASS was for the Amcrest Integration. It's using the Dahua/Amcrest API PTZ commands. The ONVIF service is completely different, and I had no hand in that.

MiAutomations commented 2 years ago

The PTZ service code I contributed to HASS was for the Amcrest Integration. It's using the Dahua/Amcrest API PTZ commands. The ONVIF service is completely different, and I had no hand in that.

I'm using this, I think that is the correct way to use the PTZ commands over the HA. Can you confirm ? But this one is not working with the Dahua/Imou cameras that I have ... I think that perhaps the API commands can help in this ... But the strange is I can move the camera over the Onvif manager software that I think use the onvif commands also... IMG_20210902_141945

Thank you

GaryOkie commented 2 years ago

The OP enhancement request is to add PTZ to the Dahua custom component. Reporting an issue or enhancement request with this Dahua custom component regarding ONVIF support is not the correct place.

I don't use ONVIF, but my understanding is that these PTZ services are only activated through the ONVIF Camera integration. That would be a core Home Assistant issue if Imou ONVIF PTZ doesn't work.

Meanwhile, you could try using the HASS Amcrest integration to see if that works for Imou. It works fine for most Dahua cameras, including those with PTZ.

MiAutomations commented 2 years ago

The OP enhancement request is to add PTZ to the Dahua custom component. Reporting an issue or enhancement request with this Dahua custom component regarding ONVIF support is not the correct place.

I don't use ONVIF, but my understanding is that these PTZ services are only activated through the ONVIF Camera integration. That would be a core Home Assistant issue if Imou ONVIF PTZ doesn't work.

Meanwhile, you could try using the HASS Amcrest integration to see if that works for Imou. It works fine for most Dahua cameras, including those with PTZ.

Great thank you for the Information, I will open request enhancement regarding the Imou/Dahua ONVIF Camera integration.

I also try the Amcrest integration without success in this case :(

image

I'm available to test any other suggestion or improvement to this

Thank you

MiAutomations commented 2 years ago

@rroller rroller

Just to share other model of the camera tested in this integration that work without any issue :)

IPC-A26HI https://s.click.aliexpress.com/e/_A3XGE2

And By the way is there any news about the PTZ function available in this integration?

Thank you

rbtying commented 1 year ago

@rroller any interest in adding the PTZ controls? I think Dahua / Amcrest cameras usually expose this via ONVIF, so it's probably not too much work