mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-21 02:51:11 +00:00
Refactor MFKZQ01LM converters to use homeassistant.sensor_action
This commit is contained in:
@@ -112,7 +112,7 @@ const parsers = [
|
||||
+---+
|
||||
Side 5 is with the MI logo, side 3 contains the battery door.
|
||||
presentValue = 0 = shake
|
||||
presentValue = 2 = wakeup
|
||||
presentValue = 2 = wakeup
|
||||
presentValue = 3 = fly/fall
|
||||
presentValue = y + x * 8 + 64 = 90º Flip from side x on top to side y on top
|
||||
presentValue = x + 128 = 180º flip to side x on top
|
||||
@@ -122,25 +122,25 @@ const parsers = [
|
||||
var v = msg.data.data['presentValue'];
|
||||
switch (true) {
|
||||
case (v == 0):
|
||||
return {cube_action: 'shake'}
|
||||
return {action: 'shake'}
|
||||
break;
|
||||
case (v == 2):
|
||||
return {cube_action: 'wakeup'}
|
||||
return {action: 'wakeup'}
|
||||
break;
|
||||
case (v == 3):
|
||||
return {cube_action: 'fall'}
|
||||
return {action: 'fall'}
|
||||
break;
|
||||
case (v >= 512): // double tap
|
||||
return {cube_action: 'tap'}
|
||||
return {action: 'tap'}
|
||||
break;
|
||||
case (v >= 256): // slide
|
||||
return {cube_action: 'slide'}
|
||||
return {action: 'slide'}
|
||||
break;
|
||||
case (v >= 128): // 180 flip
|
||||
return {cube_action: 'flip180'}
|
||||
return {action: 'flip180'}
|
||||
break;
|
||||
case (v >= 64): // 90 flip
|
||||
return {cube_action: 'flip90'}
|
||||
return {action: 'flip90'}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -162,9 +162,9 @@ const parsers = [
|
||||
*/
|
||||
var v = msg.data.data['presentValue'];
|
||||
if (v < 0) {
|
||||
return {cube_action: 'rotate', direction: 'left'}
|
||||
return {action: 'rotate_left'}
|
||||
} else {
|
||||
return {cube_action: 'rotate', direction: 'right'}
|
||||
return {action: 'rotate_right'}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+3
-2
@@ -98,8 +98,9 @@ const devices = {
|
||||
'lumi.sensor_cube': {
|
||||
model: 'MFKZQ01LM',
|
||||
vendor: 'Xiaomi',
|
||||
description: 'MiJia Smart Home Cube',
|
||||
homeassistant: [homeassistant.sensor_button]
|
||||
description: 'Mi smart home cube',
|
||||
supports: 'TODO',
|
||||
homeassistant: [homeassistant.sensor_action]
|
||||
},
|
||||
'lumi.plug': {
|
||||
model: 'ZNCZ02LM',
|
||||
|
||||
Reference in New Issue
Block a user