Axis camera component

https://github.com/home-assistant/home-assistant/issues/10402

1 Like

Hi,

I’m running HASS.io on a RPi2 and trying to get a Axis M1034-W to work with it. A couple of versions ago, probably a week or two, I got it to work but now I don’t. Have tried to configure it through the front-end and also through input in configuration.yaml.

My configuration file:

axis:
m1034w:
host: 192.168.1.77
username: homeassistant
password: !secret axis_password
include:
- camera
- motion
- pir
- sound
- tampering
- input
location: “Köket”

Error message:

2017-11-13 22:11:38 ERROR (MainThread) [asyncio] Unhandled error in exception handler
context: {‘exception’: KeyError(‘Source_value’,)}
Traceback (most recent call last):
File “uvloop/handles/udp.pyx”, line 339, in uvloop.loop.__uv_udp_on_receive (uvloop/loop.c:105874)
File “uvloop/handles/udp.pyx”, line 241, in uvloop.loop.UDPTransport._on_receive (uvloop/loop.c:104790)
File “/usr/lib/python3.6/site-packages/axis/rtsp.py”, line 168, in datagram_received
self.callback(‘data’)
File “/usr/lib/python3.6/site-packages/axis/streammanager.py”, line 62, in session_callback
self.event.manage_event(self.data)
File “/usr/lib/python3.6/site-packages/axis/event.py”, line 81, in manage_event
new_event = AxisEvent(data)
File “/usr/lib/python3.6/site-packages/axis/event.py”, line 110, in init
self.id = data[‘Source_value’]
KeyError: ‘Source_value’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “uvloop/loop.pyx”, line 1879, in uvloop.loop.Loop.call_exception_handler (uvloop/loop.c:35032)
File “/usr/lib/python3.6/site-packages/homeassistant/core.py”, line 94, in async_loop_exception_handler
_LOGGER.error(“Error doing job: %s”, context[‘message’], **kwargs)
KeyError: ‘message’

So it worked as it should in an earlier hass-release? Weird, haven’t changed the parsing afaik.

The received event doesn’t contain all expected values necessary to register a new event according to the backtrace. Can you enable debug?

Any ideas why the frame rate would be much lower when uses the Axis camera component versus just using the MJPEG component?

With the Axis component, the frame rate feels like its around 1 or 2 FPS. But with the MJPEG component, the frame rate is very smooth.

I’m using an M3113 on firmware version 5.50.5.1

Are you using the same resolution as Axis component? It’s the same code beneath

Hi Robban. Sorry, it’s me again. After upgrading to 0.58 with your patch, my log file is flooded with axis errors every minute.

Failed to parse headers (url=http://192.168.2.7:80/axis-cgi/mjpg/video.cgi): [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''
08:47 lib/python3.5/site-packages/urllib3/util/response.py (WARNING)
Failed to parse headers (url=http://192.168.2.7:80/axis-cgi/mjpg/video.cgi): [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''
08:46 lib/python3.5/site-packages/urllib3/util/response.py (WARNING)
Failed to parse headers (url=http://192.168.2.7:80/axis-cgi/mjpg/video.cgi): [StartBoundaryNotFoundDefect(), 

Detail error:

Failed to parse headers (url=http://192.168.2.7:80/axis-cgi/mjpg/video.cgi): [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/connectionpool.py", line 399, in _make_request
    assert_header_parsing(httplib_response.msg)
  File "/srv/homeassistant/lib/python3.5/site-packages/urllib3/util/response.py", line 66, in assert_header_parsing
    raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data)
urllib3.exceptions.HeaderParsingError: [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''

Any idea what this could be? The camera is functioning alright. And thank you for all your efforts!

Kind regards,

  • Wilfred

This is a known issue with one of the libraries that the jpeg camera component uses (which the axis camera component is based on)

See the note here https://home-assistant.io/components/camera.mjpeg/

Oké, I know this error exists, but from now on (0.58) I cannot suppress it anymore in the log file.

The following logger configuration should suppress it, shouldn’t it?

logger:
  default: error
  logs:
    homeassistant.components.camera: fatal
    requests.packages.urllib3: fatal

I think so, historically I’ve used requests.packages.urllib3.connectionpool: fatal, but that is a subset of what you have so shouldn’t differ.

I’ve not upgraded to 0.58, have a new component I want in for 0.59 so I will wait to spend time on upgrading until after that has been merged. :slight_smile:

Yep. Resolution on the camera is set to 800x600. I’ve experimented with a couple of different resolutions, but same result. Smooth frame rate with MJPEG component but choppy with Axis component.

The component requests the default stream I think http://{}:{}/axis-cgi/mjpg/video.cgi, so I guess if you change default settings for the camera you will get the same.

If you want it in another way please give a suggestion of how that would be :slight_smile:

Hmm. Well, that’s not the URL that I’m using in the MJPEG component. In the MJPEG component, I’m using http://CameraIP/mjpg/video.mjpg. So I swapped out that URL and put in http://CameraIP/axis-cgi/mjpg/video.cgi....and it was also smooth…so I’m not sure what’s going on. I’m running HA in a Docker…not sure if that matters.

Bonkers…

If the url is the same the result should be the same…

Hello
I’m on HA 0.58 and just have my camera configured with:

axis:
  carport:
    host: !secred axis_ip
    username: !secret axis_user
    password: !secret axis_pass
    include:
      - camera
      - pir
      - motion
      - tampering
    location: carport

I do see the camera but I do not see any sensors. Also in the log there is nothing except the parse error mentioned above. Is there anything else I need to configure?
Thanks

What camera and firmware do you have?

M2026-LE, 7.30 I think

Yeah that should definitely work.
Can you enable debugging for the axis component?

Hmm, Have you enabled motion detection in the camera? It won’t create sensors unless they’re available.
That camera doesn’t have PIR. It has IR lamp for the camera sensor for night vision.

It does have tampering and motion detection. I have both enabled. How can I enable the debugging of it?

Checkout the logger component.

Which motion detection have you enabled? :slight_smile:

The Axis Video Motion Detection (4) in Apps. Are you in gitter/discord somewhere to not clutter this thread?