home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.7k stars 30.45k forks source link

Axis integration reports an error when adding an Axis M7001 Camera #114504

Closed sjogreen closed 6 months ago

sjogreen commented 6 months ago

The problem

I'm running into a problem adding an Axis M7001 to camera. After providing login details I see "Unknown Error Occurred". I've previously successfully added this camera to Home Assistant, so something changed in a recent version update.

I've confirmed that I'm running the latest Axis firmware for this camera (5.20.5) and the latest version of Home Assistant.

What version of Home Assistant Core has the issue?

core-2024.3.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Axis

Link to integration documentation on our website

https://www.home-assistant.io/integrations/axis/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
First occurred: 3:20:40 PM (2 occurrences)
Last logged: 3:30:43 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 94, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 25, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 68, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 197, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 111, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 359, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 405, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 502, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/axis/config_flow.py", line 70, in async_step_user
    device = await get_axis_device(self.hass, MappingProxyType(user_input))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/axis/device.py", line 261, in get_axis_device
    await device.vapix.initialize()
  File "/usr/local/lib/python3.12/site-packages/axis/vapix/vapix.py", line 145, in initialize
    await self.initialize_param_cgi(preload_data=False)
  File "/usr/local/lib/python3.12/site-packages/axis/vapix/vapix.py", line 189, in initialize_param_cgi
    await asyncio.gather(*tasks)
  File "/usr/local/lib/python3.12/site-packages/axis/vapix/interfaces/api_handler.py", line 126, in update
    obj_ids = await self._update()
              ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/axis/vapix/interfaces/parameters/param_handler.py", line 39, in _update
    return await self.vapix.params.request_group(self.parameter_group)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/axis/vapix/interfaces/parameters/param_cgi.py", line 52, in request_group
    self.signal_subscribers(obj_id)
  File "/usr/local/lib/python3.12/site-packages/axis/vapix/interfaces/api_handler.py", line 42, in signal_subscribers
    callback(obj_id)
  File "/usr/local/lib/python3.12/site-packages/axis/vapix/interfaces/parameters/param_handler.py", line 44, in _update_params_callback
    self._items.update(self.parameter_item.decode_to_dict([data]))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/axis/vapix/models/parameters/param_cgi.py", line 92, in decode_to_dict
    return {"0": cls.decode(data[0])}
                 ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/axis/vapix/models/parameters/properties.py", line 191, in decode
    embedded_development=data["EmbeddedDevelopment"]["Version"],
                         ~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'EmbeddedDevelopment'

Additional information

No response

home-assistant[bot] commented 6 months ago

Hey there @kane610, mind taking a look at this issue as it has been labeled with an integration (axis) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `axis` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign axis` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


axis documentation axis source (message by IssueLinks)

Kane610 commented 6 months ago

Hello. Follow the instructions to enable debug logging for the integration and share the log output

sjogreen commented 6 months ago

Thanks for the fast response, here you go:

2024-03-30 16:20:54.202 DEBUG (MainThread) [axis.rtsp] OPTIONS rtsp://10.0.10.34/axis-media/media.amp?video=0&audio=0&event=on RTSP/1.0 CSeq: 4 User-Agent: HASS Axis Session: A2E96358

2024-03-30 16:20:54.206 DEBUG (MainThread) [axis.rtsp] Received data ['RTSP/1.0 200 OK', 'CSeq: 4', 'Session: A2E96358', 'Public: DESCRIBE, GET_PARAMETER, PAUSE, PLAY, SETUP, SET_PARAMETER, TEARDOWN', 'Date: Sat, 30 Mar 2024 23:15:46 GMT', ''] from 10.0.10.34 2024-03-30 16:21:05.091 DEBUG (MainThread) [axis.vapix.vapix] post, http://10.0.10.31:80/axis-cgi/apidiscovery.cgi, 'b'{"apiVersion":"1.0","context":"Axis library","method":"getApiList"}'', 'None', 'None' 2024-03-30 16:21:05.109 DEBUG (MainThread) [axis.vapix.vapix] <Response [404 Not Found]>, Client error '404 Not Found' for url 'http://10.0.10.31/axis-cgi/apidiscovery.cgi' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 2024-03-30 16:21:05.109 DEBUG (MainThread) [axis.vapix.vapix] post, http://10.0.10.31:80/axis-cgi/param.cgi, 'None', '{'action': 'list', 'group': 'root.Properties'}', 'None' 2024-03-30 16:21:05.111 DEBUG (MainThread) [axis.vapix.vapix] post, http://10.0.10.31:80/axis-cgi/param.cgi, 'None', '{'action': 'list', 'group': 'root.Brand'}', 'None' 2024-03-30 16:21:05.112 DEBUG (MainThread) [axis.vapix.vapix] post, http://10.0.10.31:80/axis-cgi/param.cgi, 'None', '{'action': 'list', 'group': 'root.IOPort'}', 'None' 2024-03-30 16:21:05.113 DEBUG (MainThread) [axis.vapix.vapix] post, http://10.0.10.31:80/axis-cgi/param.cgi, 'None', '{'action': 'list', 'group': 'root.StreamProfile'}', 'None' 2024-03-30 16:21:05.545 DEBUG (MainThread) [axis.vapix.vapix] Response (from 10.0.10.31 /axis-cgi/param.cgi): b'root.Properties.API.HTTP.Version=3\nroot.Properties.API.HTTP.AdminPath=/operator/basic.shtml\nroot.Properties.API.Metadata.Metadata=no\nroot.Properties.API.Metadata.Version=1.0\nroot.Properties.API.RTSP.Version=2.01\nroot.Properties.API.RTSP.RTSPAuth=yes\nroot.Properties.API.WebService.WebService=yes\nroot.Properties.API.WebService.ONVIF.ONVIF=yes\nroot.Properties.API.WebService.ONVIF.Version=1.01\nroot.Properties.Firmware.BuildNumber=1\nroot.Properties.Firmware.BuildDate=Jun 13 2017 14:38\nroot.Properties.Firmware.Version=5.20.5\nroot.Properties.GuardTour.GuardTour=yes\nroot.Properties.HTTPS.HTTPS=yes\nroot.Properties.Image.Rotation=0,90,180,270\nroot.Properties.Image.Resolution=D1,4CIF,2CIF,CIF,QCIF\nroot.Properties.Image.Format=jpeg,mjpeg,h264,bitmap\nroot.Properties.Image.NbrOfViews=1\nroot.Properties.Motion.Motion=yes\nroot.Properties.Motion.MaxNbrOfWindows=10\nroot.Properties.PTZ.PTZ=yes\nroot.Properties.PTZ.DigitalPTZ=no\nroot.Properties.PTZ.DriverManagement=yes\nroot.Properties.RemoteService.RemoteService=yes\nroot.Properties.RTC.RTC=no\nroot.Properties.Serial.Serial=yes\nroot.Properties.System.Language=English\nroot.Properties.System.HardwareID=163\nroot.Properties.System.SerialNumber=ACCC8E1A909D\nroot.Properties.System.Architecture=crisv32\n' 2024-03-30 16:21:05.548 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 94, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 25, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 68, in handle result = await handler(request, request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin return await func(self, request, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 197, in post return await super().post(request, flow_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper result = await method(view, request, data, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 111, in post result = await self._flow_mgr.async_configure(flow_id, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 359, in async_configure result = await self._async_configure(flow_id, user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 405, in _async_configure result = await self._async_handle_step( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 502, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/axis/config_flow.py", line 70, in async_step_user device = await get_axis_device(self.hass, MappingProxyType(user_input)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/axis/device.py", line 261, in get_axis_device await device.vapix.initialize() File "/usr/local/lib/python3.12/site-packages/axis/vapix/vapix.py", line 145, in initialize await self.initialize_param_cgi(preload_data=False) File "/usr/local/lib/python3.12/site-packages/axis/vapix/vapix.py", line 189, in initialize_param_cgi await asyncio.gather(*tasks) File "/usr/local/lib/python3.12/site-packages/axis/vapix/interfaces/api_handler.py", line 126, in update obj_ids = await self._update() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/axis/vapix/interfaces/parameters/param_handler.py", line 39, in _update return await self.vapix.params.request_group(self.parameter_group) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/axis/vapix/interfaces/parameters/param_cgi.py", line 52, in request_group self.signal_subscribers(obj_id) File "/usr/local/lib/python3.12/site-packages/axis/vapix/interfaces/api_handler.py", line 42, in signal_subscribers callback(obj_id) File "/usr/local/lib/python3.12/site-packages/axis/vapix/interfaces/parameters/param_handler.py", line 44, in _update_params_callback self._items.update(self.parameter_item.decode_to_dict([data])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/axis/vapix/models/parameters/param_cgi.py", line 92, in decode_to_dict return {"0": cls.decode(data[0])} ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/axis/vapix/models/parameters/properties.py", line 191, in decode embedded_development=data["EmbeddedDevelopment"]["Version"],


KeyError: 'EmbeddedDevelopment'
2024-03-30 16:21:05.928 DEBUG (MainThread) [axis.vapix.vapix] Response (from 10.0.10.31 /axis-cgi/param.cgi): b'root.StreamProfile.MaxGroups=20\nroot.StreamProfile.S0.Name=Quality\nroot.StreamProfile.S0.Description=Best image quality and full frame rate.\nroot.StreamProfile.S0.Parameters=videocodec=h264&resolution=4CIF&compression=20&fps=0&videokeyframeinterval=8&videobitrate=0\nroot.StreamProfile.S0.Default.Name=Quality\nroot.StreamProfile.S0.Default.Description=Best image quality and full frame rate.\nroot.StreamProfile.S0.Default.Parameters=videocodec=h264&resolution=4CIF&compression=20&fps=0&videokeyframeinterval=8&videobitrate=0\nroot.StreamProfile.S1.Name=Balanced\nroot.StreamProfile.S1.Description=Medium image quality and frame rate.\nroot.StreamProfile.S1.Parameters=videocodec=h264&resolution=4CIF&compression=30&fps=15&videokeyframeinterval=15&videobitrate=0\nroot.StreamProfile.S1.Default.Name=Balanced\nroot.StreamProfile.S1.Default.Description=Medium image quality and frame rate.\nroot.StreamProfile.S1.Default.Parameters=videocodec=h264&resolution=4CIF&compression=30&fps=15&videokeyframeinterval=15&videobitrate=0\nroot.StreamProfile.S2.Name=Bandwidth\nroot.StreamProfile.S2.Description=Low bandwidth with medium image quality.\nroot.StreamProfile.S2.Parameters=videocodec=h264&resolution=4CIF&compression=50&fps=15&videokeyframeinterval=32&videobitrate=250&videomaxbitrate=1000&videobitratepriority=framerate\nroot.StreamProfile.S2.Default.Name=Bandwidth\nroot.StreamProfile.S2.Default.Description=Low bandwidth with medium image quality.\nroot.StreamProfile.S2.Default.Parameters=videocodec=h264&resolution=4CIF&compression=50&fps=15&videokeyframeinterval=32&videobitrate=250&videomaxbitrate=1000&videobitratepriority=framerate\nroot.StreamProfile.S3.Name=Mobile\nroot.StreamProfile.S3.Description=Mobile device settings.\nroot.StreamProfile.S3.Parameters=videocodec=h264&resolution=QCIF&compression=50&fps=15&videokeyframeinterval=32&videobitrate=120&videomaxbitrate=128&videobitratepriority=quality&audio=0\nroot.StreamProfile.S3.Default.Name=Mobile\nroot.StreamProfile.S3.Default.Description=Mobile device settings.\nroot.StreamProfile.S3.Default.Parameters=videocodec=h264&resolution=QCIF&compression=50&fps=15&videokeyframeinterval=32&videobitrate=120&videomaxbitrate=128&videobitratepriority=quality&audio=0\n'
2024-03-30 16:21:05.932 DEBUG (MainThread) [axis.vapix.vapix] Response (from 10.0.10.31 /axis-cgi/param.cgi): b''
2024-03-30 16:21:05.939 DEBUG (MainThread) [axis.vapix.vapix] Response (from 10.0.10.31 /axis-cgi/param.cgi): b'root.Brand.Brand=AXIS\nroot.Brand.ProdFullName=AXIS M7001 Video Encoder\nroot.Brand.ProdShortName=AXIS M7001\nroot.Brand.ProdNbr=M7001\nroot.Brand.ProdType=Network Video Encoder\nroot.Brand.WebURL=http://www.axis.com/\n'
2024-03-30 16:21:49.207 DEBUG (MainThread) [axis.rtsp] OPTIONS rtsp://10.0.10.34/axis-media/media.amp?video=0&audio=0&event=on RTSP/1.0
CSeq: 4
User-Agent: HASS Axis
Session: A2E96358

2024-03-30 16:21:49.212 DEBUG (MainThread) [axis.rtsp] Received data ['RTSP/1.0 200 OK', 'CSeq: 4', 'Session: A2E96358', 'Public: DESCRIBE, GET_PARAMETER, PAUSE, PLAY, SETUP, SET_PARAMETER, TEARDOWN', 'Date: Sat, 30 Mar 2024 23:16:41 GMT', ''] from 10.0.10.34
Kane610 commented 6 months ago

Thanks! Your logs helped, it will be fixed with 2024.4 release

sjogreen commented 6 months ago

Appreciate it, thank you!

Kane610 commented 6 months ago

Fix is up, aiming to have it solved in 2024.4 release. Thanks for providing data to resolve the issue.