Hacking the XiaomiFang Wifi camera

Are you saying with the hack you can not only view the camera stream on HA but also listen to any sounds from the live stream? As the camera has a built in mic and speaker, so I suppose you could also talk from HA and get the output from the camera’s speaker?

1 Like

The camera is working fine. I have a couple around the house with the hack and no issues whatsoever.

I haven’t really tried to turn them off. Will try different settings and let you know.

Haven’t tried that either. My primary intention was for the camera not to connect to china. The hack satisfies that.

1 Like

@Mukund That would be great if you can try to see if there is a way to turn it off or stop streaming … I think that they are cute cameras and I could see the use of stacking 2 of them together in some areas. Keep us posted if you can.

I did all. It works well on VLC (rtsp://IP/unicast), also well in Tinycam pro.

but is not working in HASS, no matter the commands I use.

I think have a problem with ffmpeg component, not sure how to solve

what about this – Rtsp stream support for camera

I run a windows 7 VM on my QNAP and then use contacam to convert the rtsp feed into a jpg which works perfectly in HA. I do that for 2 camera that only have rtsp as I found rtsp in HA was god damn slow. I use the VM as my backup server, so now I have found another use for it :slight_smile:

Only issue with this and the hack is the nightvision is just rubbish, blocky/grainy black and white. Is this normal ?

Cheers
Mark

hi i got my cam today and followed the tutorial. Well … I cannot see anything in vlc… no connection could be etablished … do i have to deactivate the cloud? the hack is running on the cam

ok works… but home assistant (hassio) freezes and breaks down when trying to watch the stream

Are you using the RTSP or MJPEG stream?
I have been using the RTSP and its working OK on my hass.io install… but am running hass.io on a VM on xeon server, so has much more cpu etc for ffmpeg to process the 1080p stream from the xiaofang.
BTW the out of box ffmpeg provided in hass.io image is working fine, but I noticed that the rtsp server on the camera is not very stable and often quits :frowning:

I’m going to try the MJEPG version of the xiaofang hack linked above.

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.

I did the following:

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 :frowning:

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 :slight_smile: 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 :wink:

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:

camera:
- platform: ffmpeg
name: HomeCamera
input: -rtsp_transport tcp -i rtsp://192.X.X.X/unicast

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:

camera:
  - platform: ffmpeg
    name: HomeCamera
    input: -rtsp_transport tcp -i rtsp://192.X.X.X/unicast

-> My question it’s the following: Is it possible to increase the frames per second that we can see in HASS?

Don’t wanna be rude but the documented yaml config is right. Kits more a problem of hassio that it crashes I guess

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 config is the same:

camera:
  - platform: ffmpeg
    input: -rtsp_transport tcp -i rtsp://192.168.1.33/unicast
    name: Xiaofang 1

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 :slight_smile: )
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.

Lets try the MJPEG version of the video server :slight_smile:

this happens to me constantly… and the restart option doesn’t work

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 :frowning: )

Good point so I guess I’ll have to gwait be t a try by building it my own

Guys you should follow this threat here… It is verys good and works like a charm!

4 Likes