Dafang camera streaming problem

I have problem with streaming from my Dafang camera, and the camera states as “Inactive”.

I am new to HA, and has just set up my first Xiaomi Dafang IP camera using the procedure from https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks

Everything worked fine, and I can access the camera’s rtsp stream from my VLC player on rtsp://192.168.0.27:8554/unicast

In the configuration.yaml file, I have the following codes

camera:

  • platform: ffmpeg
    name: Cam1
    username: my_user_name
    password: password_to_camera
    input: -rtsp_transport tcp -i rtsp://192.168.0.27:8554/unicast
    verify_ssl: false

In my HA I get the below view. However, I don’t know why it says that camera is inactive (lower right corner of the picture). Also when I click on the camera, I don’t see any stream at all.

Have you the same problem and is there anything I have missed?

I think the state being inactive (aka idle) is normal for this type of camera.

Do you have the stream component enabled (by adding stream: to your configuration)?

After using it for some time now, I also realize that the state “idle” is normal for this type of component.

Regarding the stream, no, I haven’t used that. Maybe that is the part I missed? I will check it up tomorrow. Do you mean that I should substitute camera in my configuration.yaml with stream? I have tried to look up on the stream: in configuration.yaml from google search, but could not seem to find any documentation to read up on.

Thanks, I will test it tomorrow and report back.

No, stream is a separate component. When it is not enabled, and you click on the camera thumbnail in the frontend, the “more info” window will open and it will update by taking multiple “snapshots” (from the RTSP URL.) However, when the stream component is enabled, then the “more info” window should use the stream component to “live stream” from the RTSP URL.

So, your config should have both what you have now, and add:

stream:

See the stream documentation.

BTW, I don’t use the ffmpeg camera. I use the amcrest integration. So I can’t say for sure if the live streaming will actually work for you. Maybe someone else that uses the ffmpeg camera will chime in.

Oh, I’m guessing you do, but do you have ffmpeg configured, too? As in:

ffmpeg:

See the ffmpeg documentation.

Thanks so much for this suggestion! I have got it up and running now. It really helped. Also today there was an update for Hassio, and I noticed that one of the feature for the update was the possibility to go live with the camera.

1 Like

If you are seeing artefacts when streaming using this firmware (I think this happens on some hardware but not others) see my video settings in my post here: Hacking the XiaomiFang Wifi camera

I use generic instead of ffmpeg and I’m happy with the results, not sure if ffmpeg is better or not? Using generic has zero impact on my tinkerboard hardware.

do you solved how? Do you see now streaming against inactive?

I am having issues related to Dafang Camera, which led me to this thread. I just can’t get the camera to show any picture in Home Assistant. I successfully installed Hacks. All checkboxes are active. I am running latest HASSIO.

I can see a picture and edit settings in https://dafang/
In VLC player it shows the live stream at rtsp://dafang:8554/unicast

I have set up ffmpeg: and stream:

I have tried:

camera:
  - platform: ffmpeg
    name: dafang
    input: -rtsp_transport tcp -i rtsp://dafang:8554/unicast

and

camera:
  - platform: generic
    name: dafang
    username: root
    password: ismart12
    authentication: basic
    still_image_url: https://dafang/cgi-bin/currentpic.cgi
    verify_ssl: false
    framerate: 5

(notice the framerate is different from what was in the documentation, scan_interval), otherwise it wouldnt validate configuration.

The image is still a gray box with a broken square on it.

**

> Update: replaced dafang with actual IP address, and worked.

**

2 Likes