Conversation
|
Hello, my device is correctly recognized after adding mapping to type id When I try to listen for actions no one is fired: device.on('action', event => {
console.log(`Action handled!`) // never called
})
device.on('action:flip90', event => {
console.log(`Action flip90 handled!`) // never called
})
device.on('action:rotate', event => {
console.log('Action rotate handled!', event.amount) // never called
})being too complex the logic of the library I am not able to do any kind of debugging... Any suggestions? Can you provide a code snippet to listen to ? |
|
Hello @daaru00 Make sure that your Hope it helps |
|
Hi,
yes, I double checked and I correctly using the subdevice: device.on('action', async data => console.log('Action handled!', data))
console.log(device)
MiioDevice {
model=lumi.cube,
types=controller, miio, miio:subdevice, sub-thing,
capabilities=actions, state
}but nothing, even using // Listen for all actions
device.onAny((event, params) => {
console.log('Action handled!', event, params)
})
// Bind all actions one by one
const actions = await device.actions()
actions.forEach(action => {
console.log(`Start listening for action ${action.id}..`)
device.on(`action:${action.id}`, async data => {
console.log(`Action '${action.id}' handled! ${JSON.stringify(data)}`)
})
})even adding What's your device model? I suspect it's not the same model.. mine is |
Aqara Cube has a device type id
68.Used the same code as for Mi Cube (device type id
8)