local device = {} device.model = "TS0601_smoke_5" device.vendor = "Tuya" device.description = "Smoke sensor" device.exposes = { { type = "binary", name = "smoke", property = "smoke", access = 1, value_on = true, value_off = false, description = "Indicates whether the device detected smoke", }, { type = "binary", name = "tamper", property = "tamper", access = 1, value_on = true, value_off = false, description = "Indicates whether the device is tampered", }, { 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 = "binary", name = "fault_alarm", property = "fault_alarm", access = 1, value_on = true, value_off = false, description = "Indicates whether a fault was detected", }, { type = "binary", name = "silence", property = "silence", access = 3, value_on = true, value_off = false, description = "Silence the alarm", }, { type = "binary", name = "alarm", property = "alarm", access = 3, value_on = "ON", value_off = "OFF", description = "Enable the alarm", }, { 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 = "battery_low", property = "battery_low", access = 1, value_on = true, value_off = false, description = "Indicates if the battery of this device is almost empty", category = "diagnostic", }, } device.fromZigbee = { "ias_zone", "battery" } device.tuyaDatapoints = { { dp = 1, name = "smoke", converter = "trueFalse0" }, { dp = 4, name = "tamper", converter = "raw" }, { dp = 11, name = "fault_alarm", converter = "trueFalse1" }, { dp = 15, name = "battery", converter = "raw" }, { dp = 16, name = "silence", converter = "raw" }, { dp = 17, name = "alarm", converter = "onOff" }, } device.configure = { bind = { "ssIasZone", "genPowerCfg" }, reporting = { { cluster = "genPowerCfg", attribute = "batteryPercentageRemaining", min = 3600, max = 65000, change = 0, }, { cluster = "genPowerCfg", attribute = "batteryVoltage", min = 3600, max = 65000, change = 0, }, }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE200_ytibqbra", }, } return device