Xiaomi Yi command line util and library

jnordberg

New Member
Joined
Jun 4, 2016
Messages
1
Reaction score
5
Country
Algeria
Hi everyone! I've written a node.js library and command line tool for controlling the camera, I found a lot of useful information on this forum and thought i'd contribute with something back.

The library can be found here: https://github.com/jnordberg/yichan and the command line tool here: https://github.com/jnordberg/yikun

I've been digging around in the binaries on the camera and found some commands I haven't seen anyone mention here before. There's a list here: https://github.com/jnordberg/yichan/blob/master/src/index.coffee

Also, the tool can execute ambsh commands via an autoexec.ash loop so you can adjust things like ISO on the fly instead of having to wait for a camera reboot.

Installation instructions
  • Install node.js
  • Run npm install -g yikun in your teminal (or cmd.exe on windows)
  • Run yikun --help to see available commands

You also need to put this in your autoexec.ash if you want to be able to execute ambsh commands:

Code:
while true; do
    d:\commands.ash
    rm d:\commands.ash
    sleep 1
done

Cheers!
 
Hi jnordberg -- this is very exciting. I've got a question that will likely seem silly but it's been a long time since I tried to mess with the Yi -- do I need to install something on the camera itself other than those few lines to autoexec.ash? And what is the form of a <camera_path>?
 
I've been playing around with this, but i keep getting
ERROR: Timed out

No matter what command i try to issue to the camera.
(I can ping, telnet & ftp to the IP address i'm using)

I've tried in Windows 10, and in Debian 7 (Wheezy) after successfully installing the NPM & Yikun packages.

Verbose Outputs:
root@MTCNAS:/# yikun -V
1.4.0

root@MTCNAS:/# yikun -v -A 192.168.0.150 battery
connecting to 192.168.0.150
connected to camera
ERROR: Timed out
[Error: Timed out]

root@MTCNAS:/# yikun -v -A 192.168.0.150 exec help
connecting to 192.168.0.150
connected to camera
ERROR: Timed out
 
Last edited:
yikun exec doesn't work to execute ambarella shell command with this autoexec.ash:
Code:
while true; do
    d:\commands.ash
    rm d:\commands.ash
    sleep 1
done

But it works with this:
Code:
mkdir d:\commands
  while true; do
    if (mv d:\commands\lock d:\commands\locked) > d:\.null; then
      rm d:\commands\locked > d:\.null
      d:\commands\exec.ash > d:\.null
      rm d:\commands\exec.ash > d:\.null
    fi
    sleep 1
  done
Source
 
Back
Top