miio.chuangmi_camera module

Xiaomi Chuangmi camera (chuangmi.camera.ipc009, ipc013, ipc019, 038a2) support.

class miio.chuangmi_camera.CameraStatus(data: Dict[str, Any])[source]

Bases: DeviceStatus

Container for status reports from the Xiaomi Chuangmi Camera.

embed(other: DeviceStatus)

Embed another status container to current one.

This makes it easy to provide a single status response for cases where responses from multiple I/O calls is wanted to provide a simple interface for downstreams.

Internally, this will prepend the name of the other class to the property names, and override the __getattribute__ to lookup attributes in the embedded containers.

sensors() Dict[str, SensorDescriptor]

Return the dict of sensors exposed by the status container.

You can use @sensor decorator to define sensors inside your status class.

settings() Dict[str, SettingDescriptor]

Return the dict of settings exposed by the status container.

You can use @setting decorator to define sensors inside your status class.

switches() Dict[str, SwitchDescriptor]

Return the dict of sensors exposed by the status container.

You can use @sensor decorator to define sensors inside your status class.

property flip: bool

Image 180 degrees flip status.

property full_color: bool

Full color with bad lighting conditions.

property improve_program: bool

Customer experience improvement program status.

property light: bool

Camera light status.

property max_client: int


property mini_level: int


property motion_record: bool

Motion record status.

property night_mode: int

Night mode.

property power: bool

Camera power.

property sdcard_status: int

SD card status.

property track: bool

Tracking status.

property watermark: bool

Apply watermark to video.

property wdr: bool

Wide dynamic range status.

class miio.chuangmi_camera.ChuangmiCamera(ip: Optional[str] = None, token: Optional[str] = None, start_id: int = 0, debug: int = 0, lazy_discover: bool = True, timeout: Optional[int] = None, *, model: Optional[str] = None)[source]

Bases: Device

Main class representing the Xiaomi Chuangmi Camera.


Sound a loud alarm for 10 seconds.

buttons() List[ButtonDescriptor]

Return a list of button-like, clickable actions of the device.


Clear NAS directory.

configure_wifi(ssid, password, uid=0, extra_params=None)

Configure the wifi settings.


Flip image 180 degrees off.


Flip image 180 degrees on.


Full color off.


Full color on.

classmethod get_device_group()

Get NAS config info.

get_properties(properties, *, property_getter='get_prop', max_properties=None)

Request properties in slices based on given max_properties.

This is necessary as some devices have limitation on how many properties can be queried at once.

If max_properties is None, all properties are requested at once.

  • properties (list) – List of properties to query from the device.

  • max_properties (int) – Number of properties that can be requested at once.


List of property values.


Improve program off.


Improve program on.

info(*, skip_cache=False) DeviceInfo

Get (and cache) miIO protocol information from the device.

This includes information about connected wlan network, and hardware and software versions.


bool (skip_cache) – Skip the cache


Light off.


Light on.


Motion record off, always record video.


Start recording when motion detected.


Motion record off, video recording stopped.


Auto switch to night mode.


Night mode off.


Night mode always on.


Power off.


Power on.

raw_command(command, parameters)

Send a raw command to the device. This is mostly useful when trying out commands which are not implemented by a given device instance.

  • command (str) – Command to send

  • parameters (dict) – Parameters to send

rotate(direction: Direction)[source]

Rotate camera to given direction (left, right, up, down).

send(command: str, parameters: Optional[Any] = None, retry_count: Optional[int] = None, *, extra_parameters=None) Any

Send a command to the device.

Basic format of the request: {“id”: 1234, “method”: command, “parameters”: parameters}

extra_parameters allows passing elements to the top-level of the request. This is necessary for some devices, such as gateway devices, which expect the sub-device identifier to be on the top-level.

  • command (str) – Command to send

  • parameters (dict) – Parameters to send

  • retry_count (int) – How many times to retry on error

  • extra_parameters (dict) – Extra top-level parameters

  • model (str) – Force model to avoid autodetection


Send initial handshake to the device.

sensors() Dict[str, SensorDescriptor]

Return sensors.

set_home_monitoring_config(mode: HomeMonitoringMode = HomeMonitoringMode.AllDay, start_hour: int = 10, start_minute: int = 0, end_hour: int = 17, end_minute: int = 0, notify: int = 1, interval: int = 5)[source]

Set home monitoring configuration.

set_motion_sensitivity(sensitivity: MotionDetectionSensitivity)[source]

Set motion sensitivity (high, low).

set_nas_config(state: NASState, share=None, sync_interval: NASSyncInterval = NASSyncInterval.Realtime, video_retention_time: NASVideoRetentionTime = NASVideoRetentionTime.Week)[source]

Set NAS configuration.

settings() Dict[str, SettingDescriptor]

Return list of settings.

status() CameraStatus[source]

Retrieve properties.

switches() Dict[str, SwitchDescriptor]

Return toggleable switches.

update(url: str, md5: str)

Start an OTA update.

update_progress() int

Return current update progress [0-100].


Return current update state.


Watermark off.


Watermark on.


Wide dynamic range off.


Wide dynamic range on.

property device_id: int

Return device id (did), if available.

property model: str

Return device model.

property raw_id: int

Return the last used protocol sequence id.

retry_count = 3
supported_models = ['chuangmi.camera.ipc009', 'chuangmi.camera.ipc013', 'chuangmi.camera.ipc019', 'chuangmi.camera.038a2']
timeout = 5
class miio.chuangmi_camera.Direction(value)[source]

Bases: Enum

Rotation direction.

Down = 4
Left = 1
Right = 2
Up = 3
class miio.chuangmi_camera.HomeMonitoringMode(value)[source]

Bases: IntEnum

Home monitoring mode.

AllDay = 1
Custom = 2
Off = 0
class miio.chuangmi_camera.MotionDetectionSensitivity(value)[source]

Bases: IntEnum

Motion detection sensitivity.

High = 3
Low = 1
class miio.chuangmi_camera.NASState(value)[source]

Bases: IntEnum

NAS state.

Off = 2
On = 3
class miio.chuangmi_camera.NASSyncInterval(value)[source]

Bases: IntEnum

NAS sync interval.

Day = 86400
Hour = 3600
Realtime = 300
class miio.chuangmi_camera.NASVideoRetentionTime(value)[source]

Bases: IntEnum

NAS video retention time.

HalfYear = 15552000
Month = 2592000
Quarter = 7776000
Week = 604800
Year = 31104000