How to debug generic camera component on hassio?

Hi all,

I’m trying to get my DAFANG (CFW) cameras working on my new hassio installation. I found RTSP to be unreliable (presumably due to the low-powered CPU in my rpi 3b), so I’ve been attempting this configuration:

- platform: generic
  name: Kid #1
  username: root
  password: <random password>
  authentication: basic
  still_image_url: https://kid1-camera.myinternaldomain.com/cgi-bin/currentpic.cgi
  verify_ssl: false
  scan_interval: 30

But this fails 90% of the time (I had one, random unexplained success), with the following error in homeassistant.log:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 242, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 523, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method
2018-12-24 09:36:24 ERROR (MainThread) [homeassistant.components.camera.generic] Timeout getting camera image
2018-12-24 09:36:25 ERROR (MainThread) [homeassistant.components.camera.generic] Timeout getting camera image
2018-12-24 09:36:25 ERROR (MainThread) [homeassistant.components.camera.generic] Timeout getting camera image

When I test the URL with curl, the image downloads fine:

 curl -k https://root:<mypassword>@kid1-camera.myinternaldomain.com/cgi-bin/currentpic.cgi > ~/Desktop/image.jpg

I’ve added the following to configuration.yaml to try to debug, but nothing additional to the above is logged:

logger:
  default: warning
  logs:
    homeassistant.components: info
    homeassistant.components.device_tracker: critical
    homeassistant.components.camera.generic: debug

Any ideas how to proceed from here?

Thanks!
D

No help from my side too. But I am trying to do the exact same thing following the example here: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/integration/homeassistant/homeassistant.md

and I have the same timeout.

The difference with my installation is that I don’t see the invalid HTTP method error.

Just adding a note that the mqtt image without lovelace works. I can see the last frame during motion detection.
Activating lovelace I don’t find a way to use picture, picture glance etc… I don’t want to save the picture before displaying it.

EDIT: I just found this: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/issues/638 maybe it is interesting. Reading it right now.

I found that too, so the generic camera solution was my workaround. But it doesn’t seem to be working reliably :frowning:

I am getting this as well now on my second dafang. With a camera that worked just fine before. First dafang started with this behavoiur a week ago. Reflashing demo bin and setting everything up again makes it work for a while. It seems it breaks after using the shell commands for a while (moving camera). But moving camera by inserting the same http in web browser works fine. It is all really strange.

My issue may be different to yours, but I’ve noticed that when it happens, although I can ping the camera from hassio, I can’t establish any TCP connection. No SSH banner on port 22, no response to curl, nothing. If I change the camera’s IP (I know, right?), or reboot hassio, TCP connectivity sometimes recovers, but I still get timeouts using either ffmpeg or generic still images in hassio.

And of course, while hassio is affected, other hosts (like my Macbook) are not.

Remove SSL.