local device = {} device.model = "SNZB-01P" device.vendor = "SONOFF" device.description = "Wireless button" device.zigbeeModel = { "SNZB-01P" } device.exposes = { { type = "numeric", name = "battery", property = "battery", access = 5, unit = "%", min = 0, max = 100, description = "Remaining battery in %", category = "diagnostic", }, { type = "numeric", name = "voltage", property = "voltage", access = 5, unit = "mV", description = "Reported battery voltage in millivolts", category = "diagnostic", }, { type = "enum", name = "action", property = "action", access = 1, description = "Triggered action (e.g. a button click)", category = "diagnostic", values = { "single", "double", "long" }, }, } 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