Mi Home Read

Read value from Mi Home Device

If you followed the steps to get the token run the following commands 🙂

These examples are all Mi Home fanza4 related, please find and use any other device names as needed.

Check what device you got, for the next step :

mirobo --ip YourDeviceIP --token YourDeviceToken info

The result could be :

$ mirobo --ip YourDeviceIP --token YourDeviceToken info
zhimi.fan.za4 v2.0.3 (FF:FF:FF:FF:FF:FF) @ YourDeviceIP - token: YourDeviceToken

Check the help for the correct devicename (mine is zhimi.fan.za4, found with last command):

miiocli --help

The result :

$ miiocli --help
Usage: miiocli [OPTIONS] COMMAND [ARGS]...

Options:
  -d, --debug
  -o, --output [default|json|json_pretty]
  --version                       Show the version and exit.
  --help                          Show this message and exit.

Commands:

Check Hardware,Firmware and Connection (mine is fanza4 found with the last commands):

miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken info

The result could be :

$ miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken info
Model: zhimi.fan.za4
Hardware version: esp32
Firmware version: 2.0.3
Network: {'localIp': '127.0.0.1', 'mask': '255.255.255.0', 'gw': '127.0.0.1'}
AP: {'rssi': -52, 'ssid': 'einstein.amsterdam', 'primary': 1, 'bssid': '00:00:00:00:00:00'}

Check status of Mi Home Fan:

miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken status

The result could be :

$ miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken status
Power: off
Battery: None %
AC power: True
Temperature: None °C
Humidity: None %
LED: None
LED brightness: LedBrightness.Dim
Buzzer: False
Child lock: False
Speed: 0
Natural speed: 0
Direct speed: 50
Oscillate: True
Power-off time: 0
Angle: 30

You can also get the output as json :

miiocli -o json_pretty fanza4 --ip YourDeviceIP --token YourDeviceToken status

The result could be :

$ miiocli -o json_pretty fanza4 --ip YourDeviceIP --token YourDeviceToken status
{
  "angle": 30,
  "speed": 0,
  "poweroff_time": 0,
  "power": "off",
  "ac_power": "on",
  "angle_enable": "on",
  "speed_level": 50,
  "natural_level": 0,
  "child_lock": "off",
  "buzzer": 0,
  "led_b": 1,
  "use_time": 4265
}

If you want to write to the device continue here.