- Devices: Aqara Switch (round and square), Aqara Light Switch, Aqara Dual Light Switch
- Model identifiers:
lumi.switch
,lumi.switch.aq2
,lumi.86sw1
,lumi.86sw2
Controllers are devices whose primary function is to control something else.
These devices will have the capability actions
and their primary
function will be emitting events. Single button switches will be of the type
button
and other switches are translated into the type
wall-controller
. Controllers may also have the capability
battery-level
if they can report their battery level.
if(device.matches('cap:actions')) {
/*
* This device is a controller of some sort.
*/
}
device.on('action', event => console.log('Action', event.action, 'with data', event.data));
device.on('action:idOfAction', data => ...);
// Get the available actions
device.actions()
.then(actions => ...)
.catch(...);
// Using async/await
const actions = await device.actions();
Actions - cap:actions
device.actions()
- get all of the available actionsdevice.on('action', event => ...)
- listen for all actionsdevice.on('action:<id>', data => ...)
- listen for action with name<id>
Round button connected to a Mi Gateway. Supports the actions click
,
double_click
, long_click_press
and long_click_release
.
Square button connected to a Mi Gateway. Supports the actions click
and double_click
.
Cube connected to a Mi Gateway. Supports the actions alert
, flip90
,
flip180
, move
, tap_twice
, shake_air
, free_fall
and rotate
.
When the action is rotate
the data in the event will be an object including
the key amount
. Example use:
device.on('action:rotate', data => console.log('Rotation amount:', data.amount));
Wall Switch with one button. Supports the actions: click
and double_click
Wall Switch with two buttons. Suppors the actions btn0-click
,
btn0-double_click
, btn1-click
, btn1-double_click
and both_click
.