Repository: blakeblackshear/frigate

Issue:
[Support]: PTZ only with zoom
### Describe the problem you are having

I have ONFIV camera only support ZOOM action. When frigate try fetch presets Igot following error "Optional Action Not Implemented"


### Version

0.13 dev

### Frigate config file

```yaml
cameras:
  back:
    ffmpeg:
      ...
    onvif:
      host: 10.0.10.10
      port: 8000
      user: admin
      password: password
```


### Relevant log output

```shell
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:xmime4="http://www.w3.org/2004/11/xmlmime" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsrf-bf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrf-r="http://docs.oasis-open.org/wsrf/r-2" xmlns:tes-e="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:tes-nc="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding" xmlns:tes-np="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:tes-sm="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:xmime="http://www.w3.org/2004/06/xmlmime" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tan-ae="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding" xmlns:tan-re="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:tpl="http://www.onvif.org/ver10/plus/wsdl" xmlns:tplt="http://www.onvif.org/ver10/plus/schema"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><SOAP-ENV:Fault><SOAP-ENV:Code><SOAP-ENV:Value>SOAP-ENV:Receiver</SOAP-ENV:Value><SOAP-ENV:Subcode><SOAP-ENV:Value>ter:ActionNotSupported</SOAP-ENV:Value></SOAP-ENV:Subcode></SOAP-ENV:Code><SOAP-ENV:Reason><SOAP-ENV:Text xml:lang="en">Optional Action Not Implemented</SOAP-ENV:Text></SOAP-ENV:Reason><SOAP-ENV:Detail></SOAP-ENV:Detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
[2023-05-15 03:46:58] frigate.ptz                    ERROR   : Unable to get presets from camera: front: Unknown error: Optional Action Not Implemented
```


### FFprobe output from your camera

```shell
no output
```


### Frigate stats

_No response_

### Operating system

Other

### Install method

Docker CLI

### Coral version

USB

### Network connection

Wired

### Camera make and model

BCS-P-265R3WSM-G

### Any other information that may be helpful

_No response_


Discussion:
Interesting, it makes sense that presets not being implemented should not block onvif init. I'll update this logic

Resolving patch:
diff --git a/frigate/ptz.py b/frigate/ptz.py
--- a/frigate/ptz.py
+++ b/frigate/ptz.py
@@ -79,8 +79,8 @@ def _init_onvif(self, camera_name: str) -> bool:
         try:
             presets: list[dict] = ptz.GetPresets({"ProfileToken": profile.token})
         except ONVIFError as e:
-            logger.error(f"Unable to get presets from camera: {camera_name}: {e}")
-            return False
+            logger.warning(f"Unable to get presets from camera: {camera_name}: {e}")
+            presets = []
 
         for preset in presets:
             self.cams[camera_name]["presets"][preset["Name"].lower()] = preset["token"]


Test patch: