Hacking & Using Xiaomi XiaoFang WiFi Camera w/ openHAB

I purchased some cheap Wifi cameras with the intention of connecting them to my openHAB setup. I think they were about $30 each and got good reviews.

Xiaomi 1080P smart IP camera is quite popular among the personal purpose safety consideration consumers. Affordable price, practical features, user-friendly operation are the 3 main reasons why the Xiaomi 1080P smart IP camera becomes so welcomed


These cameras are designed as “cloud only” but, with some hacking… they can be configured to (hopefully) work with openHAB. So here we go!

A few resources that helped kick-start me.

Youtube Video:
Xiaomi Xiaofang Hack! RTSP.

AP mode to connect Xiaomi 1080P smart IP camera to phone

We need to enable RTSP (Real Time streaming protocol) — which is where the “modding comes in”


I spend a good amount of time trying to avoid installing the MI Home app on my phone and connecting the camera to the cloud, but it was the only way I could get the camera on my wifi network. The app would not allow me to view the camera as it claimed it was for “mainland China” use only and it did not permit it to be used abroad.

I wanted to get RTSP working so that I could stream the video (and hopefully integrate into openHAB)

I came across the FANG-HACKS repository on GitHub: Read the instructions/issues etc there, but here is generally the steps that I took.

  1. Download an sd-card image from the releases page on GitHub

  2. Flash to sd card using WIN32Image or better yet in linux using dd ( sudo dd if=image.img of=/dev/sdb bs=1M) * Be absolutely sure of the output so you don’t wipe out your hard drive :slight_smile:

  3. Prerequisite - You should by now have connected your camera to your wifi using the MI Home app (Note: I recommend going into your router and assigning the device as a static IP. Take note of the IP address, you will need it later.

  4. Power on camera and wait until LED is solid blue (camera connected to your wifi network)

  5. Insert SD card and wait about 10-15 seconds. you should hear a “ting ting” sound over the camera speaker to signal it worked.

  6. open a webbrowser and navigate to http:///cgi-bin/status

If everything is configured correctly, you should reach a webpage (running on the cam) that will allow you to enable the Hacks.

From there, click the NETWORK button and configure the camera in Wireless Client mode. Change the radio option and select your Access Point from the list. enter your Wifi password, click connect.

Then click Apply.

Click the Manage Scripts button and you should see the services all running (green). The most important one is the rtsp-server. if this is RED try to run the 00-Stop-Cloud, and then stop/start the 20-rtsp-server again.

once running, you should be able to open VLC or another video program and open a network location using the format rtsp://device-ip/unicast (example: rtsp://

If this works, we can proceed to the next step.

Disable Cloud applications - since we are now using this device in Wireless Client mode, we do not need it contacting its cloud servers. (potential privacy / security concern) so we can disable this. Check the box and click Apply

That is about where I am now.

Important to note:

Once the hack is applied you need to leave the card inserted, if you remove the card and reboot/unplug the camera it reverts to normal behavior without the rtsp server running. If this happens, just pop the card back in and reboot.

  • you can remove the card once it is running - I did this so that I could get both cameras working.

I’m now going to interface these into OpenHAB and will provide an update once I crack that nut.



Hey i was thiking buying this cam too! I hate Xiaomi app so a was looking for an integration with OH2 so thanks !

Do you still able to use the “intercom” mode ?

i have these cameras too ,did you manage to bind them with openhab?Can u give us more details?

i have a couple of these running and they work well through a synology.
if you run into a situation where the video stops, see this thread on github:

I did not. I used feng firmware which allowed me to stream video but was not able to get it working in openHab. anytime power was lost, had to re-install the firmware hack. Great little camera, but not something I was willing to invest anymore time on.

Alguem conseguiu fazer esta camera funcionar no openhab?

This is an international forum, can you repost in English, please?

Hi Everyone, quick update as a few of you have asked…

Unfortunately I hit a point where the amount of time invested was not yielding the results that warranted continued pursuit. I called it off and have since unplugged the cameras.

I will eventually seek out some better cameras. Just don’t have a need at the moment.


Using the same Dafang os - the MQTT integration makes this cheaper than most PIR sensors with the bonus of video IMHO. No problems with them stopping running.