Mjpeg Camera Not Loading ... Where can I find logs?

Trying to get my IP camera working with mjpeg and having problems. I can access the following URL from my desktop browser and load and view the mjpeg stream without issue:

http://mycamera.localcamera/cgi-bin/mjpg/video.cgi?channel=1&subtype=2

(prompted to log in with basic auth)

I can also ping the camera at ping mycamera.localcamera without issue from within Home Assistant OS SSH terminal.

Here is the config I am using:

camera:
  - platform: mjpeg
    mjpeg_url: http://mycamera.localcamera/cgi-bin/mjpg/video.cgi?channel=1&subtype=2
    name: Front Yard
    username: admin
    password: !secret mycamera_password
    authentication: basic

With this, the picture entity card loads up on the dashboard blank.

image

Looking at network logs from browser developer tools, I see that network requests to https://hass.mydomain.com/api/camera_proxy/camera.front_yard?authSig=xxxxx are failing with 500 server errors. The same happens when I click the card to try to view the camera feed.

How can I debug this further? Where would I find server logs showing me why the proxy is throwing 500 errors. Looking at the home-assistant.log doesn’t show me anything.

Note: I also tried using the camera IP address rather than hostname. Same problem.

Update: Found this log under supervisor > system > core logs, but not very much usable info:

ERROR (stream_worker) [homeassistant.components.stream.worker] Error opening stream http://mycamera.localcamera/cgi-bin/mjpg/video.cgi?channel=1&subtype=2

The 500 error indicates a problem on the camera’s side, the best HA can show you is that it got the error - which it is doing.

You can try embedding your username and password into the link to see if that will work better:

http://admin:[email protected]/cgi-bin/mjpg/video.cgi?channel=1&subtype=2

I have tried including the basic auth credentials in the URL, but that doesn’'t work either.

I don’t understand how the problem could be on the camera’s side if I can load the mjpeg stream using the same URL from various other platforms. As a test, I even created a picture entity card with the image set to http://admin:[email protected]/cgi-bin/mjpg/video.cgi?channel=1&subtype=2 and it works. Unfortunately, that is not a good solution. For whatever reason, it seems to only be a problem when loaded from the camera proxy.

I am also seeing 500 errors on my system; the Firefox debug console lists the response headers as:

HTTP/1.1 500 Internal Server Error
Content-Type: text/plain; charset=utf-8
Content-Length: 26
Date: Mon, 29 Aug 2022 21:05:22 GMT
Server: Python/3.10 aiohttp/3.8.1

The camera is running the xiaomi dafang hacks firmware and I’m seeing many entries reading 192.168.100.66 dafang-front.lan - [29/Aug/2022:14:06:40 -0700] "GET /cgi-bin/currentpic.cgi HTTP/1.1" 200 385422 "-" "HomeAssistant/2022.8.7 httpx/0.23.0 Python/3.10" so I’m not convinced it’s the camera. Also I have not updated the camera’s firmware in a while but this has started exhibiting recently.

My version info: Home Assistant 2022.8.7 Supervisor 2022.08.5 Operating System 8.5 Frontend 20220802.0 - latest (running on a RPi 3 on Ethernet.)