local device = {} device.model = "TS0601_smoke_co" device.vendor = "Tuya" device.description = "Dual smoke CO 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 = "enum", name = "smoke_state", property = "smoke_state", access = 1, description = "Possible states: alarm, none, detecting, unknown", values = { "alarm", "none", "detecting", "unknown" }, }, { type = "enum", name = "alarm_volume", property = "alarm_volume", access = 3, description = "Alarm volume", values = { "mute", "low", "medium", "high" }, }, { 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 = "silence", property = "silence", access = 3, value_on = true, value_off = false, description = "Silence the alarm", }, { type = "binary", name = "alarm_switch", property = "alarm_switch", access = 3, value_on = true, value_off = false, description = "Disable the alarm", }, { type = "binary", name = "carbon_monoxide", property = "carbon_monoxide", access = 1, value_on = true, value_off = false, description = "Indicates if CO (carbon monoxide) is detected", }, } device.fromZigbee = { "battery" } device.tuyaDatapoints = { { dp = 5, name = "alarm_volume", converter = "lookup", lookup = { low = 0, medium = 1, high = 2, mute = 3 } }, { dp = 15, name = "battery", converter = "raw" }, { dp = 16, name = "silence", converter = "raw" }, { dp = 17, name = "alarm_switch", converter = "raw" }, { dp = 18, name = "carbon_monoxide", converter = "trueFalseEnum0" }, } device.configure = { bind = { "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 = "_TZE284_6ycgarab", }, } return device