I’m using the SXJ02ZM xiaomi all white camera with the openfang hack (https://github.com/anmaped/openfang). I have multiple problems which I don’t know how to deal with. My setup in my config is as follows:
stream:
camera:
- platform: generic
name: "Palantir"
still_image_url: https://192.168.0.39/cgi-bin/currentpic.cgi
stream_source: rtsp://192.168.0.39:8554/unicast
verify_ssl: false
In this setup I get a preview image and the rtsp stream without any issues in lovelace (also with preview). When I try to record/snapshot it does not work though and most likely crash my rtsp stream/cam. When I try to stream it to my chromecast my image stays black on my chromecast after a loading screen.
Since openfang uses some encryption I also tried to enable verify_ssl: true
. That resulted in the preview image not being shown anymore, the stream itself still worked. When I now try to record I get the message that it is already recording, although it never finishes/creates a file. The snapshot still does not work. When checking the logs I can find the following error:
2020-01-29 18:45:30 ERROR (MainThread) [homeassistant.components.generic.camera] Error getting new camera image: Cannot connect to host 192.168.0.39:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)')]
2020-01-29 18:45:30 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2889301296] a bytes-like object is required, not 'NoneType'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
connection.context(msg),
File "/usr/src/homeassistant/homeassistant/core.py", line 1226, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1251, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 201, in handle_service
self._platforms.values(), func, call, service_name, required_features
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 335, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 359, in _handle_service_platform_call
await func(entity, data)
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 658, in async_handle_snapshot_service
await hass.async_add_executor_job(_write_image, snapshot_file, image)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 655, in _write_image
img_file.write(image_data)
TypeError: a bytes-like object is required, not 'NoneType'
2020-01-29 18:45:37 ERROR (MainThread) [homeassistant.components.generic.camera] Error getting new camera image: Cannot connect to host 192.168.0.39:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)')]
Unfortunately I have no idea how to set this up correctly. Having the rtsp stream working is nice, but not being able to record/take snapshots is kinda stupid. I also don’t really understand how the “preview” is working (since this is basically saving the stream) but actually recording something does not work.
Any help would be appreciated.