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.
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.
Download an sd-card image from the releases page on GitHub
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
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.
Power on camera and wait until LED is solid blue (camera connected to your wifi network)
Insert SD card and wait about 10-15 seconds. you should hear a “ting ting” sound over the camera speaker to signal it worked.
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://192.168.0.55/unicast)
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.