local device = {} device.model = "WXKG02LM_rev1" device.vendor = "Aqara" device.description = "Wireless remote switch (double rocker), 2016 model" device.zigbeeModel = { "lumi.sensor_86sw2", "lumi.sensor_86sw2.es1" } 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 = "power_outage_count", property = "power_outage_count", access = 1, description = "Number of power outages", category = "diagnostic", }, { type = "enum", name = "action", property = "action", access = 1, description = "Triggered action (e.g. a button click)", category = "diagnostic", values = { "single_left", "single_right", "single_both" }, }, } device.fromZigbee = { "on_off", "battery", "electrical" } device.configure = { bind = { "genOnOff", "genPowerCfg", "haElectricalMeasurement" }, reporting = { { cluster = "genOnOff", attribute = "onOff", min = 0, max = 3600, change = 0, }, { 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