local device = {} device.model = "SNZB-05P" device.vendor = "SONOFF" device.description = "Zigbee water sensor" device.zigbeeModel = { "SNZB-05P" } device.exposes = { { type = "numeric", name = "battery", property = "battery", access = 5, unit = "%", min = 0, max = 100, description = "Remaining battery in %", category = "diagnostic", }, { type = "binary", name = "water_leak", property = "water_leak", access = 1, value_on = true, value_off = false, description = "Indicates whether the device detected a water leak", }, { type = "binary", name = "battery_low", property = "battery_low", access = 1, value_on = true, value_off = false, description = "Indicates whether the battery of the device is almost empty", category = "diagnostic", }, { type = "binary", name = "occupancy", property = "occupancy", access = 1, value_on = true, value_off = false, description = "Indicates whether the device detected occupancy", }, { type = "binary", name = "contact", property = "contact", access = 1, value_on = false, value_off = true, description = "Indicates if the contact is closed or open", }, { type = "binary", name = "tamper", property = "tamper", access = 1, value_on = true, value_off = false, description = "Indicates whether the device is tampered", }, } device.fromZigbee = { "battery", "ias_zone" } device.configure = { bind = { "genPowerCfg", "ssIasZone" }, reporting = { { cluster = "genPowerCfg", attribute = "batteryPercentageRemaining", min = 3600, max = 65000, change = 0, }, { cluster = "genPowerCfg", attribute = "batteryVoltage", min = 3600, max = 65000, change = 0, }, }, } return device