I was looking for a simple and cheap Wifi camera that would work with Home Assistant and doesn't rely solely on cloud recording since that can go expensive very speedily. In my search, I came across the Xiaomi Xiaofang camera. Although this camera is 'cloud but' past default, @samtap on GitHub has created FangHacks, which is a prepare of scripts that can exist installed on the Xiaofang to enable RTSP, forth with a bunch of other features. It will also show y'all how to add together this into Dwelling house Assistant. This postal service will go through the steps involved in installing these modifications.

Hither'southward what you will need:

  • Xiaomi Xiaofang camera – NOTE: This camera is probable the China version. The cloud recording part probably won't piece of work anywhere exterior of China. If yous are only planning on recording the video locally similar I am, so that shouldn't really matter.
  • MicroSD Card | Amazon – Notation: I initially had a 2GB SD card, and I couldn't not get anything to piece of work. I switch to a 16GB menu and it worked. The 2GB bill of fare worked everywhere else, but not here. I'm wondering if the Xiaofang only reads SDHC cards(commonly cards that are 4gb or more). If you run across issues where it seems similar the photographic camera isn't reading the menu, try another carte.
  • Optional  Camera Mount – This mount can be used outside.
  • Windows estimator – This can probably be washed with other Os'es, but these steps are all what I did on a Windows figurer.
  • Win32 Win Disk Imager – Go ahead and install this.
  • Home Assistant – Optional
  • Ivideon – Optional – This is the software that I use to record from my cameras. Y'all tin can store locally forever, and they will also shop on the cloud for a day for costless ( The paid plans will store it longer ).

Note: While I was putting together this writeup, the RTSP feed on the camera appears to be hanging every few days. The web interface stays up, and I can just go tohttp://CamIP/cgi-bin/action?cmd=reboot to reboot it. I oasis't automated this notwithstanding, but I remember I might use Home Assistant to do that. I'm not certain if this is a problem that will happen on all cameras or just this ane that I take.

Here are the steps:

  1. Downgrade the Firmware
    By default, this camera uses the latest Chinese version of their firmware. However, this version prevents the Fang Hacks scripts from working. And then this step is for downgrading to a lower version that is likewise in English.
    1. Download the firmware from Hither
    2. Copy that file to your empty microSD carte. It should be the but file on the SD Card:
    3. Unplug the camera and put the SD Card in there.
    4. While using the pin that came with the camera to push the SETUP push on the bottom of the camera, plug the camera in. Continue holding the reset button for 10 seconds. This causes the photographic camera to go into its 'firmware update style' and volition copy that bin file to its internal memory.
    5. After a few minutes, the camera will brand a noise, so you will know information technology is on the new firmware.
  2. Setup the device on Wifi
    1. Open the MiHome app, and follow the steps there to setup the WiFi on the photographic camera.
    2. In the last stride, it probably won't find the camera since the camera volition non work with the Chinese servers exterior of China. That's OK. It should take an IP address on it and information technology should be connected to the network now.
    3. Login to your router to find the IP address of the unit of measurement. If your router shows y'all the MAC addresses of the connected devices, you tin utilise that to find it in the list on your router. The MAC is on a sticker on the photographic camera'due south back.
    4. If you don't know how to notice it on your router, y'all tin download and run AngryIP Scanner. Run information technology and accept information technology scan your network and find the IP address associated with that MAC address.
  3. Load the scripts onto the SD Bill of fare.
    1. Put the SD Card back into your reckoner and delete the firmware file from the SD Card.
    2. Download the Fang Hacks image. It's the latest cipher file from Hither. Unzip the file to anywhere on your hard drive.
    3. Open up Win32 Disk Imager.
    4. Click the Browse button, and point information technology to the file that yous unzipped earlier.
    5. Select the Bulldoze Letter for the SD Card.
    6. Click the Write button. This should take about a infinitesimal. The SD Menu should look like below:
  4. Run the scripts.
    1. Power on the camera ( Don't put the SD Card in yet ).
    2. Wait for the camera to connect to WiFi and initialize. If you wait about a infinitesimal, yous should be fine.
    3. Put the SD Card in the camera. After around 10 seconds, you should hear a 'ding' sound. That ways the scripts are loaded.
    4. Become to the following address in your browser, replacing camIP with the IP of the camera: http://camIP/cgi-bin/status
    5. If y'all become the Fang Hacks folio, that'southward a good sign.
    6. Click the Apply button to actuate the hacks.
    7. Do NOT Bank check THE 'DISABLE CLOUD Application'. If you desire to disable the cloud applications, make sure yous go to 'Network' and setup your WiFi settings appropriately.
    8. Every bit long equally the SD card is in the photographic camera, the hacks volition now be applied beyond reboots.
  5. Test your photographic camera.
    1. You tin can test your camera using apps such as TinyCam or VLC or iVideon. Simply use rtsp://camIP:554/unicast as the address.
  6. Optional – View your photographic camera in Home Assistant
    1. Use the following code in your Abode Banana .yaml file to encounter the camera in Habitation Banana:
      ffmpeg:  photographic camera:   - platform: ffmpeg     name: Garage Cam     input: rtsp://192.168.45.83:554/unicast
    2. HASS will so grab an image from the camera every 10 seconds and testify it on the home page.

I hope this is able to assist someone out. I had a lot of problem getting a lot of this information with the firmware and downgrading, so I was thinking there might exist others that would like this info in 1 identify. If you have any questions or comments, experience free to post them below. I unremarkably reply fairly rapidly.

I also take mine setup with my Garage Door Controller and so that the Telegram notifications for it will send a picture of the garage when the garage is left open for a while. I will probably post how to practise that soon.