local device = {} device.model = "ZNCZ03LM" device.vendor = "Xiaomi" device.description = "Mi smart plug TW" device.zigbeeModel = { "lumi.plug.mitw01" } device.exposes = { { type = "switch", features = { { type = "binary", name = "state", property = "state", access = 7, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", }, }, }, { type = "numeric", name = "power", property = "power", access = 5, unit = "W", description = "Instantaneous measured power", }, { type = "numeric", name = "energy", property = "energy", access = 1, unit = "kWh", description = "Sum of consumed energy", }, { type = "numeric", name = "device_temperature", property = "device_temperature", access = 1, unit = "°C", description = "Temperature of the device", category = "diagnostic", }, { type = "numeric", name = "voltage", property = "voltage", access = 1, unit = "V", description = "Measured electrical potential value", }, } device.fromZigbee = { "on_off", "electrical", "metering" } device.toZigbee = { "on_off" } device.configure = { bind = { "genOnOff", "haElectricalMeasurement", "seMetering" }, reporting = { { cluster = "genOnOff", attribute = "onOff", min = 0, max = 3600, 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, }, { cluster = "seMetering", attribute = "currentSummDelivered", min = 5, max = 3600, change = 1, }, }, } return device