local device = {} device.model = "TS0601_gas_sensor_2" device.vendor = "Tuya" device.description = "Gas sensor" device.exposes = { { type = "binary", name = "gas", property = "gas", access = 1, value_on = true, value_off = false, description = "Indicates whether the device detected gas", }, { type = "numeric", name = "gas_value", property = "gas_value", access = 1, unit = "LEL", description = "Measured gas concentration", }, { type = "binary", name = "self_test", property = "self_test", access = 3, value_on = true, value_off = false, description = "Indicates whether the device is being self-tested", }, { type = "enum", name = "self_test_result", property = "self_test_result", access = 1, description = "Result of the self-test", values = { "checking", "success", "failure", "others" }, }, { type = "binary", name = "silence", property = "silence", access = 3, value_on = true, value_off = false, description = "Silence the alarm", }, { type = "enum", name = "alarm_ringtone", property = "alarm_ringtone", access = 3, description = "Ringtone of the alarm", values = { "melody_1", "melody_2", "melody_3", "melody_4", "melody_5" }, }, { type = "numeric", name = "alarm_time", property = "alarm_time", access = 3, unit = "s", min = 1, max = 180, value_step = 1, description = "Alarm time", }, { type = "binary", name = "preheat", property = "preheat", access = 1, value_on = true, value_off = false, description = "Indicates sensor preheat is active", }, } device.tuyaDatapoints = { { dp = 1, name = "gas", converter = "trueFalseEnum0" }, { dp = 2, name = "gas_value", converter = "divideBy10" }, { dp = 6, name = "alarm_ringtone", converter = "lookup", lookup = { melody_1 = 0, melody_2 = 1, melody_3 = 2, melody_4 = 3, melody_5 = 4 } }, { dp = 7, name = "alarm_time", converter = "raw" }, { dp = 8, name = "self_test", converter = "raw" }, { dp = 9, name = "self_test_result", converter = "selfTestResult" }, { dp = 10, name = "preheat", converter = "raw" }, { dp = 16, name = "silence", converter = "raw" }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE200_yojqa8xn", }, { model = "TS0601", manufacturer = "_TZE204_zougpkpy", }, { model = "TS0601", manufacturer = "_TZE204_chbyv06x", }, { model = "TS0601", manufacturer = "_TZE204_yojqa8xn", }, { model = "TS0601", manufacturer = "_TZE284_chbyv06x", }, } return device