local device = {} device.model = "MFKZQ01LM" device.vendor = "Aqara" device.description = "Cube" device.zigbeeModel = { "lumi.sensor_cube", "lumi.sensor_cube.aqgl01" } device.exposes = { { type = "numeric", name = "battery", property = "battery", access = 1, unit = "%", min = 0, max = 100, description = "Remaining battery in %, can take up to 24 hours before reported", category = "diagnostic", }, { type = "numeric", name = "voltage", property = "voltage", access = 1, unit = "mV", description = "Voltage of the battery in millivolts", category = "diagnostic", }, { type = "numeric", name = "action_angle", property = "action_angle", access = 1, unit = "°", min = -360, max = 360, }, { type = "numeric", name = "device_temperature", property = "device_temperature", access = 1, unit = "°C", description = "Temperature of the device", category = "diagnostic", }, { type = "numeric", name = "power_outage_count", property = "power_outage_count", access = 1, description = "Number of power outages", category = "diagnostic", }, { type = "numeric", name = "action_from_side", property = "action_from_side", access = 1, min = 0, max = 6, value_step = 1, description = "Side of the cube", }, { type = "numeric", name = "action_side", property = "action_side", access = 1, min = 0, max = 6, value_step = 1, description = "Side of the cube", }, { type = "numeric", name = "action_to_side", property = "action_to_side", access = 1, min = 0, max = 6, value_step = 1, description = "Side of the cube", }, { type = "numeric", name = "side", property = "side", access = 1, min = 0, max = 6, value_step = 1, description = "Side of the cube", }, { type = "enum", name = "action", property = "action", access = 1, description = "Triggered action (e.g. a button click)", category = "diagnostic", values = { "shake", "throw", "wakeup", "fall", "tap", "slide", "flip180", "flip90", "rotate_left", "rotate_right", }, }, } device.fromZigbee = { "battery", "electrical" } device.configure = { bind = { "genPowerCfg", "haElectricalMeasurement" }, reporting = { { cluster = "genPowerCfg", attribute = "batteryPercentageRemaining", min = 3600, max = 65000, change = 0, }, { cluster = "genPowerCfg", attribute = "batteryVoltage", min = 3600, max = 65000, change = 0, }, { cluster = "haElectricalMeasurement", attribute = "activePower", min = 5, max = 3600, change = 1, }, { cluster = "haElectricalMeasurement", attribute = "rmsVoltage", min = 5, max = 3600, change = 5, }, { cluster = "haElectricalMeasurement", attribute = "rmsCurrent", min = 5, max = 3600, change = 100, }, }, } return device