Google drive loader for xiaomi smart ip camera
Google drive loader for xiaomi smart ip camera (12CN). xiaomi_gdrive let you automatically upload your videos from xiaomi smart ip camera to your google drive account. Also it can automatically remove old files from your google drive account to prevent space exhaustion.
test
gdrive
start_time="00:00:00"
and change the time in this line to whatever you want. Example 7:35:00 pm will be:
start_time="19:35:00"
Then find the next line:
finish_time="23:59:59"
and change it to whatever you want. Example 01:00:05 am will be:
finish_time="01:00:05"
Your camera will be able to interact with the Internet from start_time to finish_time.
telnet {YOUR_CAMERA_IP_ADDRESS}
Example: telnet 192.168.0.70
Go to the browser
Create your Google Drive application and OAuth keys for Google Drive API (example tutorial: http://www.iperiusbackup.net/en/how-to-enable-google-drive-api-and-get-client-credentials/)
Example:
Go to your console back
Run GDriveConf to configure your Google Drive access:
sh /home/hd1/gdrive/GDriveConf
root
and press Enter.1
and type Enter if you want. Press 0
and type Enter if you do not want. GDriveAutoremover itself will delete old files in case if your disk space overflows.reboot
How it works: The script in the loop will create the same folders as in the record folder and upload videos into Google Drive. After the reboot, or failure of the Internet script continues normally send files. If you have enabled automatic remove, GDriveAutoremover will check your free space every 45 minutes. In case when disk space is not enough, the script will erase old videos (IMPORTANT: do not put anything extra in the folder which is designed for video because GDriveAutoremover can remove it if it considers that the disk space is not enough).
This scripts were tested under 1.8.5.1L firmware
Troubleshooting:
Your camera starts reboot from time to time. Your RAM is likely not enough. Turn off additional features which you have installed.
Turn off ftp server:
rm /etc/init.d/S89ftp
Turn off HTTP server
rm /home/web/server
rm /home/web/record
Turn off RTSP server
rm /home/rtspsvr
mv /home/recv_X.726 /home/recv.726
Reboot your camera
reboot
Check if camera can send requests to the Internet.
ping -q -c2 8.8.8.8
ping -q -c2 google.com
if it isn't pingable then check your route table:
route -n
If your gateway isn't correct then add your gateway (Where 192.168.0.1 is your router IP address):
my_router_ip="192.168.0.1"
route add default gw ${my_router_ip} ra0
To have normal gateway after reboot run all next commands:
echo "#!/bin/sh" > /etc/init.d/S65route
echo "change_def_route(){" >> /etc/init.d/S65route
echo "route add default gw ${my_router_ip} ra0" >> /etc/init.d/S65route
echo "}" >> /etc/init.d/S65route
echo "change_def_route &" >> /etc/init.d/S65route
echo "exit 0" >> /etc/init.d/S65route
chmod +x vi /etc/init.d/S65route
echo "${my_router_ip}" > /tmp/gw1
Add public DNS
echo "nameserver 8.8.8.8" > /var/run/dhcpcd/resolv.conf/resolv.conf
echo "nameserver 8.8.8.8" > /etc/resolv.conf
Reboot your camera
reboot