Setup camera in hass.io

Hello, I have a Xiaomi Mijia Aqara Gateway IP Camera (like this one: https://www.mbreviews.com/xiaomi-mijia-aqara-gateway-ip-camera-review/) and I was thinking about adding it to the home assistant (which is built on the RPi 4, 2GB ram, with supervisor), but unfortunately, I have some problems with that.

First of all, I added the portainer add-on and set up the docker container with an image described here: https://hub.docker.com/r/annbob/xiaomi-aqara-rtsp/ which gave me the proper RTSP URL for my camera. It works correctly for example in the VLC on Windows in the same network. So I tried to add it to the home assistant with the following configuration:

camera:
  - platform: ffmpeg
    name: Door camera
    input: -rtsp_transport tcp -i rtsp://[my-rtsp-url]

but it doesn’t work correctly - video is buffering for about 2 seconds, then playing but like in fast-forward, next 2 secs buffering, etc. , also it’s very laggy, so I tried something different - I added motion-eye add-on. I configured my RTSP there as a Network camera which gives me the Streaming URL with http:// at the beginning, so I added it to the configuration.yaml like this:

camera:
  - platform: mjpeg
    name: Door camera
    still_image_url: [still-image-url]
    mjpeg_url: [motion-eye-streaming-url]

which gives me a very nice preview of what is doing in my flat. I’m happy… partially, because I want to achieve also two more things with this setup:

  • I want to have the possibility to record short videos on demands (for example 10-15 seconds)
  • Create the automation on the ‘door open’ event (I have a door sensor and already got the automation for opening the door to do some staff) which also record about 10 seconds of video, so basically, both of the things came to one word: RECORD.

I have no idea how to setup properly, not sure it’s even possible… I know that event camera.record works only with both stream: and camera: configs, but with platform: mjpeg + stream: it gives me an error when I’m trying to record anything ( camera.door_camera does not support record service ) and in the platform: ffmpeg + stream: I got bad video - it’s like a video in preview mode - played like fast forward or something and it’s very laggy.

Is there anything else that I can do with that? To sum up, I want to have the possibility to have a live preview on demand of what is going in my flat and also have the possibility to record short videos (about 10 seconds) triggered by a button click or automated.

Thanks!

1 Like

I don’t think you are configuring it correctly, try

camera:
  - platform: mjpeg
    mjpeg_url: http://192.168.1.92/mjpeg
    name: #optional
    still_image_url: (insert still image URL) #optional

Or try

camera:
  - platform: generic
    stream_source: RTSP://ip-example@live
    still_image_url: (insert here) #optional
    name: #optional

Try these and if it still doesn’t work let us know :slight_smile:

Your first code about platform: mjpeg is the same which I wrote at the beginning.
I tested also the platform: generic but it doesn’t work at all (no video is being shown)