20 April 2020

Custom Firmware for Yi Home Cameras for use with Home Assistant

Hello all,
Here are my notes on flashing the firmware on Yi Home Cameras versions: 720p and 1080p, for use with Home Assistant.  The assembly consists of a black puck (the camera) and a white stand, see below:
The camera can be rotated within the stand or detached from it.  The camera is powered by a USB psu rated at 5V 1A, though the camera - unfortunately there are different versions of the same model number - hence the creation of this post consumes up to 3.5W for the most recent versions.

I bought my first pair of cameras: a 720p and a 1080p version back in 2016 and played with, but I never really found a use for them until now. 

The second pair of cameras I bought in a 'family' pack on promotion for £37.99 using discount code 'yihome22' from Amazon https://www.amazon.co.uk/YI-Wireless-Security-Detection-Surveillance/dp/B07CPRK6C5.  Normally, priced at £48.99.
 
Another two I have on order direct from Xiaomi Yi Store on Aliexpress at £14.59 each and a couple of pounds shipping from Spain, instead of China.  The only downside for the savings of £7 or £14 for the pair, compared with individual pricing, was that the USB supplies will be European or Schuko pinned.  This is no great loss since USB 5V 1A supplies can be readily sourced from Aliepxress for around £1.35 each or twin USB versions rated at 2A for £1.60: UK USB PSUs.

Hardware and Firmware Versions

Anyway onto the differences, since unfortunately the same model number 1080p, comes with different architectures and revisions: boo!  When will manufacturers and more specifically marketing departments learn *not* to reuse model numbers for different products?

The cameras bought in 2016 are based on the HiSilicon Hi3518e V200 chipset and the project for these is called yi-hack-v3.  The work is based on three other projects and credit where it is due:

  1. fritz-smh : https://github.com/fritz-smh/yi-hack
  2. niclet : https://github.com/niclet/yi-hack-v2
  3. xmflsct : https://github.com/xmflsct/yi-hack-1080p

This custom firmware gives additional functionality:

  1. SSH server - Enabled by default.
  2. Telnet server - Disabled by default.
  3. FTP server - Enabled by default.
  4. Web server - Enabled by default.
  5. Proxychains-ng - Enabled by default. Useful if the camera is region locked.

Flashing an updated firmware is a relatively straightforward affair where the two hardware specific files are loaded onto a microSD card, this is inserted into the camera and it is powered on.  The process is automatic and consists of the camera updating its onboard firmware while flashing its orange led for about 30-40 seconds.

Camerarootfs partitionhome partitionRemarks
Yi Home--Not yet supported.
Yi Home 17CN / 27US / 47USrootfs_y18home_y18Firmware files required for the Yi Home 17CN / 27US / 47US camera.
Yi 1080p Homerootfs_y20home_y20Firmware files required for the Yi 1080p Home camera.
Yi Domerootfs_v201home_v201Firmware files required for the Yi Dome camera.
Yi 1080p Domerootfs_h20home_h20Firmware files required for the Yi 1080p Dome camera.
Yi Outdoorrootfs_h30home_h30Firmware files required for the Yi Outdoor camera.
The 720p camera needed: rootfs_y18 and home_y18.  These files do not have an extension.
The 1080p camera needed: rootfs_y20 and home_y20, from the same location.
Final configuration is through the Yi Home app to set wifi credentials and through the web browser front-end visible at the default address of: http://yi-hack-v3, if your home network has mDNS, or via the IP address of the camera that can be found with the Yi Home app, under camera settings > network info.

New Cameras

The newest cameras are based on another chip the MStar chip and these require different firmware from: https://github.com/roleoroleo/yi-hack-MStar/releases
To identify which files to copy onto your freshly FAT32 formatted microSD card refer to the table below copied from the github page:

CameraFirmwareFile prefixRemarks
Yi 1080p Home 4FUS4.5.0*y203c-
Yi 1080p Home 6FUS4.5.0*y203c-
Yi 1080p Home 9FUS4.5.0*y203c-
Yi 1080p Home BFUS4.5.0*y203c-
Yi 1080p Dome 6FUS4.6.0*h201cThanks to @skylarhays
Yi 1080p Dome BFUS4.6.0*h201cThanks to @skylarhays
Yi 1080p Home 4FUS4.2.0*y25-
Yi 1080p Home 9FUS4.2.0*y25-
Yi 1080p Home 6FCNunknowny203c-
So by referring to the back of the latest cameras, the identifier is: BFUS

thus the files I need are prefixed y203c.  So following the link there are .tgz compressed archives from which the files can be extracted using 7zip.  Then copy them onto another microSD card in preparation for flashing.
Unfortunately, this time things did not go to plan - there was no flashing orange led for forty seconds - signifying the update process, and instead, the camera started as if the files were absent with its audible setup sequence.  So I checked the files again, nothing, formated the card with the SD Association official formatter software, as I have for other projects like RPi work needed to properly prepare the storage, and reload the files again nothing.  So I turned to the forums and it turns out others were having similar problems, but with different hardware.  I explained what I was experiencing and described my process so far and I received a prompt reply, thanks roleo: "Try another SD card."
It transpires the Samsung 8GB card I was using, and had been using in a RPi just wasn't playing nicely and that other users had experienced similar problems, but the cause has yet to be determined.  Swapping for another card, an old 16GB Samsung class 10 affair, the firmware update executed as expected.
So to help others and potentially unearth the unknown cause I uploaded details of the problem card, see images below: