it is easier as expected to integrate xiaomi cam into hass This can be archieved by Motioneyeos . just add the cam, after installing the hack on it, as network camera and use the streraming link in motioneyeos to stream the video.
@hijinx it might be issue with ffmpeg and raspberry cause when i add this cam with rtsp my whole system freezes. Would u mind telling us how u made it? This Method seems to be only jpeg and i want a stream not a dia show.
Added the camera to a view group with URL rtsp://device-ip/unicast
When I go the the group I can see the camera’s feed as a still.
When I click on the still image it opens an overlay card with a live (transcoded) image.
I’m just using the ffmpeg that comes pre-deployed in the hass.io home assistant container.
I can see that ffmpeg is using CPU (using top command from in the homeassistant container, and also on the esxi performance monitor) constantly whilst streaming as it’s transcoding the video.
My guess is that my x86 server has the power to do a transcode, but that RPi does not.
Nonetheless I found that the snx_rtsp_server (RTSP server) process running on the camera seems to die often
I’m not at home right now, but I can post the exact yaml later if you like?
thanks for your response… thats exactly the way i did it too. some users say it would work but more I read it doesnt work… so i made my descission to take motioneyeos to transcode the video thanks anyway… thought i’d find a snipped i missed… but we have done exactly the same thing
First of all - thanks for your dedication on this project
I’m writing to share you guys the problems I had, you might face the same, and also to make a question.
So I started by hacking the camera as described (https://github.com/samtap/fang-hacks), was really simple, and when opening in VLC the URL rtsp://192.X.X.X/unicast it’s streams(VIDEO/AUDIO) really great.
The problem came with the HASS:
In the configuration.YAML I had the folloiwng:
From the log’s I have the following error:
2017-09-25 12:08:33 ERROR (MainThread) [homeassistant.loader] Unable to find component input
2017-09-25 12:08:33 ERROR (MainThread) [homeassistant.setup] Setup failed for input: Component not found.
2017-09-25 12:08:33 ERROR (MainThread) [homeassistant.loader] Unable to find component name
2017-09-25 12:08:33 ERROR (MainThread) [homeassistant.setup] Setup failed for name: Component not found.
2017-09-25 12:08:33 ERROR (MainThread) [homeassistant.config] Invalid config for [camera.ffmpeg]: required key not provided @ data[‘input’]. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/camera.ffmpeg/
Turns that, I found that there was just a parsing issue, discovered by this tool: http://yaml-online-parser.appspot.com/
So I changed the config file to the below and start working fine:
I’m running hassio and the built in ffmpeg works fine.
I get a thumbnail of the RTSP feed about every 2-3 seconds, and if I click on the thumbnail it opens a full screen frame with full motion transcode from the camera - its pretty smooth.
My guess is that a RPi 3 does not have sufficient CPU to transcode the video in real time, and that the hassio ffmpeg is not able to offload transcode to the GPU (either not compiled correctly or simply not supported - I dont know either way )
I am using a xeon server, and even that is definitely working harder than normal to do the transcode.
(Its not maxed, but I can see the hassio VMs CPU usage shoot up in ESXi vSphere client.
My bigger problem is that the rtsp server in the camera crashes.
Out of interest, are you using the latest released fanghacks SD card image? Or did you create card image from scratch based on the latest github files?
I used the 0.2.0 image release, but seems that this is quite out of date.
Someone raised a issue in GH regarding the camera getting overheated and it causing the RTSP server to crash:
the recommendation is to upgrade to latest source.
(The 0.2.0 image is 9+ months old )
I got my cam running now for 8 hours without problems… will add another one these days. But it really seems to be stable for the moment. Easy explanation: the rtsp server is checked every x minutes and if stopped it will be restarted automatically. This could be the solution for Xiaomi Cam
I’ve been using the snx_snapshot/mjpeg technique for a while and found it stable but laggy.
There’s a new camera platform for Yi cameras that uses the continuous recording feature (also available in Mi Home for Xiaofang) and FTP (available in Xiaofang hacks). The author seems to be interested in helping Xiaofang users too. Maybe a new camera platform for Xiaofang could come out of this!