Try using the Motioneye addon.
Thanks for your suggestion. I ended up using Motioneye for now, and there it worked out fine. The next issue I have and from what I can see others seem also having is that the stream from the camera’s side is crashing after running for several hour. In such case, I can only resolve the issue by turning the stream off and on again.
I am not sure if you have other suggestions to deal with this issue?
Same here just crash
Anyone else having stability issues? These cams work and look really nice but there’s no point on that if they keep going offline every few hours or once every other day… I have to go to the interface and perform a reboot to solve this issue. Basically the streaming of video stops altogether but the cam is still connected to my WiFi and the interface is still reachable.
After a bit of trial and error with the dafang firmware I have these cameras working reliably in home assistant.
I dont recommend using the MQTT available with this firmware as it is implemented in an odd way that causes a huge volume of connections and disconnections in your MQTT broker, and in my case it was causing noticeably increased CPU usage and temperatures on my tinkerboard (and possibly MQTT broker crashes as well).
My video settings are as follows in order to remove artefacts and improve the reliability of the stream:
My audio settings are as follows to ensure that audio actually works:
Because I disabled MQTT I needed another way of enabling and disabling night mode, so I added the following commands to the action.cgi file on the microSD card:
EDIT: the latest versions of the dafang firmware now have this function built in, so you dont need to add your own custom commands. The rest functions are night_mode_on, night_mode_off and night_mode_status. I’m leaving the old instructions here in case anyone needs them.
nightvision-enable)
/system/sdcard/bin/setconf -k n -v 1
ir_led on
ir_cut off
;;
nightvision-disable)
/system/sdcard/bin/setconf -k n -v 0
ir_led off
ir_cut on
;;
You can edit this more easily via SSH by logging on to your cam using putty or similar, then using the command: vi /system/sdcard/www/cgi-bin/action.cgi
Press i to enter insert mode. Once you are done hit ESC and enter :wq to write your changes.
I can then add the following REST commands to home assistant and trigger night mode on and off (note that ismart12 is the default password for this firmware):
rest_command:
dafang_garden_nightvision_enable:
url: "https://root:ismart12@IPADDRESS/cgi-bin/action.cgi?cmd=nightvision-enable"
verify_ssl: false
And the config for streaming the camera itself:
camera:
- platform: generic
name: Garden
username: root
password: ismart12
authentication: basic
still_image_url: https://IPADDRESS/cgi-bin/currentpic.cgi
stream_source: rtsp://IDADDRESS:8554/unicast
verify_ssl: false
scan_interval: 5
Same here disconnected also
Has anybody seen(or wrote) a solution where XiaomiFang camera would detect a motion and upload the video of this motion to samba? I know there is a built in ftp option but in my case I need samba.
I guess it shouldn’t be too complicated but my programming knowledge is not good enough.
P.S. I have managed to achieved the motion detection via Motion service on my ubuntu server but since it takes a lot of (server)processing power and the camera is capable to do that, I would prefer to do that on the XiaomiFang .
Hello,
I can’t get the streaming working, I use exactly the setup you pasted above and the thumbnail in the dashboard shows correct image but when I click on it and the popup appears nothing is shown, only waiting icon spinning
If I use picture entity card I Lovelace it also shows a still image but it says that camera is “Inactive”. If I add camera_view
and then live
the picture gets blank
What can be wrong?
I got this error message in my error log.
Your configuration contains extra keys that the platform does not support.
Please remove [icon].
Configuration source: MQTT (topic: ‘homeassistant/binary_sensor/Dafang/motion/config’).
Offending data: {“name”: “Dafang motion sensor”, “unique_id”: “”, “device”: “”, “icon”: “mdi:run”, “state_topic”: “myhome/Dafang/motion”, “device_class”: “”, “platform”: “mqtt”)
Any ideas how to fix this? Where do I find the MQTT configuration. It’s not in config.yaml
Pretty sure this is dealt with earlier in the thread.
I also got a Xiaomi S1 that could successfully hack with https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks , I could as you see the still image in HA, but the RTSP does not show up.
Some info of my environment:
Xiaomi S1 (T20 processor) hacked by https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks
Raspberry Pi3 (Raspbian Stretch)
Installed ffmpeg (sudo apt-get install ffmpeg)
Included ffmpeg: in configuration
Included stream: in configuration
In the camera, using:
rtsp-h264:
VLC - Works
HA still - Works
HA RTSP stream: DO NOT WORK
rtsp-mjpeg:
VLC - Do not work
HA - Do not work
HA RTSP stream - Do nor work
In Camera configuration, I tryed the following (one each time), (As posted here):
- platform: generic
name: xiaofang1
username: root
password: ismart12
authentication: basic
still_image_url: https://192.168.1.71/cgi-bin/currentpic.cgi
stream_source: rtsp://192.168.1.71:8554/unicast
verify_ssl: false
scan_interval: 5
- platform: ffmpeg
name: xiaofang1
username: root
password: ismart12
input: -rtsp_transport tcp -i rtsp://192.168.1.71:8554/unicast
verify_ssl: false
- platform: ffmpeg
name: xiaofang1
input: -rtsp_transport tcp -i rtsp://192.168.1.71:8554/unicast
It seems that some had success using ffmpeg, but not me. It would be nice if someone could shed some more light into this, since I already tryed so many things. Am I missing something?
for the ffmpeg, try changing the name to something other than the one used for generic (at least if you have them both defined at the same time).
Also, my ffmpeg config doesn’t have the username/password/verify bits - and works. Dont think this is the problem though.
What format do you have the video stream set to?
Also as you, VBR. Pretty default settings. Noticed your bitrate 900. Quality decreased a lot using 900, but I tryed anyway, unsig ffmpeg config. As before, it does not work, even the still image, using RTSP mjpeg server. Setting the camera to RTSP H264, I get the still image, updating each 15 or 20s, but clicking in the image the stream does not show up.
Also tested this:
- platform: ffmpeg
name: xiaofang1
input: -rtsp_transport tcp -i rtsp://root:[email protected]:8554/unicast
Do you have anything different than me? Other hardware (not Pi3) or a different configuration? If it works for you it is weird…
for the ffmpeg, try changing the name to something other than the one used for generic (at least if you have them both defined at the same time).
Do you mean “xiaofang1” name? I don’t I understood what you mean, sorry.
Yes - try this - I dont think you should be defining two cameras with one ID (and I suspect this is the issue)
- platform: ffmpeg
name: xiaofang1f
I’m running direct via virtenv on Ubuntu.
cameras.yaml
- platform: ffmpeg
name: DaFang
input: -rtsp_transport tcp -i rtsp://dafang1:8554/unicast
- platform: generic
name: Camera
still_image_url: https://dafang1/cgi-bin/currentpic.cgi
# stream_source: rtsp://dafang1:8554/unicast
verify_ssl: false
username: root
password: ismart12
authentication: basic
and stream:
in configuration.yaml
In the lovelace gui I have a picture-entity card:
entity: camera.dafang
show_name: false
show_state: false
type: picture-entity
It shows the static image (usually), and then a stream.
There is an issue with streaming on some systems that causes the main HA system to lock up (0.92.2 locks up? - #12 by walaj) , but that isn’t your issue.
I will probably increase the 900bps rate now I have a better internet uplink - but it was also to save my wifi network
I got it working. Its weird, because platafform generic (in your case entity camera.camera) is not used in lovelace, but it is necessary to get it working.
The still image updates each 10s. When clicking in the image and it pops up, updates about 2 fps. It’s not a smooth stream, but it can be related to my poor hardware (Raspberry Pi3). How is yours?
I believe this will be useful for others with the same problem. Thank you for your help!
Now I can’t get the stream in VLC and TinyCam (RTSP mjpeg server). Do you know something that can be done about it? That is important because it is the best way to watch when out of home, and the stream is pretty smooth.
And yes, I am using 0.92.2. Maybe I should update, since 0.93.1 is already there, but I don’t know if something is fixed in the new version about the lock up. Maybe will let running that way and see if I will be also hit by the issue.
Thanks.
I also got it working by updating Hassio to the latest version
My config as below
camera:
- platform: ffmpeg
name: garden
input: rtsp://192.168.0.193:8554/unicast
Updated to 0.93.1.
Now I got it working under RTSP H264 Server, with ONLY the config below:
- platform: generic
name: xiaofang1
username: root
password: ismart12
authentication: basic
still_image_url: https://192.168.1.71/cgi-bin/currentpic.cgi
stream_source: rtsp://192.168.1.71:8554/unicast
verify_ssl: false
scan_interval: 5
And the stream is full 25 fps, as it is setted in my camera config. With this setup it can be also used with VLC. Great!
For those that used the Xiaomi-Dafang-Hacks,
here is a just published instructions how to integrate it with HA, including controls.
FFmpeg will probably be slow on a RPI.
I would presume the generic/rtsp is doing all the video decoding in the browser, rather than recoding via ffmpeg etc.
Re the crash - if I bring up a stream, and view it, the main hass binary will lock up soon after. I dont think this is fixed.