Mi Home Write

Write value to 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 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

Get Help for fan:

miiocli fanza4 --help

The result:

$ miiocli fanza4 --help

Turn Fan On:

miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken  on

The result:

$ miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken  on
Powering on
['ok']

Turn Fan Off:

miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken  off

The result:

$ miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken  off
Powering off
['ok']

Controll Fan Speed between 0 and 100%:

miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken set_direct_speed 100
miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken set_direct_speed 75
miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken set_direct_speed 50
miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken set_direct_speed 25

Have fun experimenting with any other settings

Commands:
  delay_off           Set delay off seconds.
  info                Get miIO protocol information from the device.
  off                 Power off.
  on                  Power on.
  raw_command         Send a raw command to the device.
  set_angle           Set the oscillation angle.
  set_buzzer          Set buzzer on/off.
  set_child_lock      Set child lock on/off.
  set_direct_speed    Set speed of the direct mode.
  set_led             Turn led on/off.
  set_led_brightness  Set led brightness.
  set_natural_speed   Set natural level.
  set_oscillate       Set oscillate on/off.
  set_rotate          Rotate the fan by -5/+5 degrees left/right.
  status              Retrieve properties.

Example : miiocli fanza4 --ip YourDeviceIP --token YourDeviceToken command value

If you want to read and write to the the device with Domoticz continue here.