miio.integrations.lumi.gateway.devices.subdevice module

Xiaomi Gateway subdevice base class.

class miio.integrations.lumi.gateway.devices.subdevice.SubDevice(gw: Gateway, dev_info: SubDeviceInfo, model_info: Dict | None = None)[source]

Bases: object

Base class for all subdevices of the gateway these devices are connected through zigbee.

get_battery() int | None[source]

Update the battery level, if available.

get_firmware_version() int | None[source]

Returns firmware version.

get_property(property)[source]

Get the value of a property of the subdevice.

get_property_exp(properties)[source]

Get the value of a bunch of properties of the subdevice.

get_voltage() float | None[source]

Update the battery voltage, if available.

push_callback(action: str, params: str)[source]

Push callback received from the push server.

register_callback(id: str, callback: Callable[[str, str], None])[source]

Register a external callback function for updates of this subdevice.

remove_callback(id: str)[source]

Remove a external callback using its id.

send(command)[source]

Send a command/query to the subdevice.

send_arg(command, arguments)[source]

Send a command/query including arguments to the subdevice.

set_property(property, value)[source]

Set a device property of the subdevice.

async subscribe_events()[source]

subscribe to all subdevice events using the push server.

unpair()[source]

Unpair this device from the gateway.

async unsubscribe_events()[source]

Unsubscibe from events registered in the gateway memory.

update()[source]

Update all device properties.

property battery

Return the battery level in %.

property device_type

Return the device type name.

property firmware_version

Return the firmware version.

property model

Return the device model.

property name

Return the name of the device.

property status

Return sub-device status as a dict containing all properties.

property voltage

Return the battery voltage in V.

property zigbee_model

Return the zigbee device model.

class miio.integrations.lumi.gateway.devices.subdevice.SubDeviceInfo(sid: str, type_id: int, unknown: int, unknown2: int, fw_ver: int)[source]

Bases: object

SubDevice discovery info.

fw_ver: int
sid: str
type_id: int
unknown: int
unknown2: int