miio.gateway.devices.subdevice module

Xiaomi Gateway subdevice base class.

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

Bases: object

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

get_battery(*args, **kwargs)
get_firmware_version(*args, **kwargs)
get_property(*args, **kwargs)
get_property_exp(*args, **kwargs)
get_voltage(*args, **kwargs)
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(*args, **kwargs)
send_arg(*args, **kwargs)
set_property(*args, **kwargs)
subscribe_events()[source]

subscribe to all subdevice events using the push server.

unpair(*args, **kwargs)
unsubscribe_events()[source]

Unsubscibe from events registered in the gateway memory.

update(*args, **kwargs)
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.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