To make it easier to work with different devices this library normalizes different models into types. These device types have their own API to match what the actual device can actually do. In addition each device also has a set of capabilities, that are used to flag that a device can do something extra on top of its type API.
Id | Description | Devices |
---|---|---|
switch |
Switchable devices such as power plugs and light switches. | Mi Smart Socket Plug, Aqara Plug, Aqara Light Control |
controller |
Devices that are primarily used to control something else. | Aqara Button, Aqara Cube, Aqara Light Switch |
gateway |
Mi Home Smart Gateway that pulls in sub devices of the Aqara type | Mi Smart Home Gateway 2, Mi Smart Home Gateway 3 |
air-purifier |
Air purifiers and air filtering devices. | Mi Air Purifier, Mi Air Purifier 2 and Mi Air Purifier Pro |
vacuum |
Robot vacuums. | Mi Robot Vacuum |
Id | Description |
---|---|
power |
Device supports being switched on or off. |
power-channels |
Device has one or more channels that can be switched on or off. Used for type switch . |
The generic
type is used when a device is of an unknown model. All properties
and methods of generic devices are also available for specific devices types.
device.defineProperty(string)
, indicate that a property should be fetched from the devicedevice.defineProperty(string, function)
, indicate that a property should be fetched from the device and mapped with the given function.device.setProperty(string, mixed)
, set the value of a propertydevice.monitor()
, monitor the device for changes in defined propertiesdevice.stopMonitoring()
, stop monitoring the device for changesdevice.on('propertyChanged', function)
, receive changes to defined propertiesdevice.getProperties(array)
, get the given properties from the device, returns a promise
device.call(string, array)
, call a method on the device with the given arguments, returns a promise