local device = {} device.model = "TS0601_gas_sensor_4" 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 = "preheat", property = "preheat", access = 1, value_on = true, value_off = false, description = "Indicates sensor preheat is active", }, { 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 = "alarm_switch", property = "alarm_switch", access = 3, value_on = true, value_off = false, }, { type = "binary", name = "silence", property = "silence", access = 3, value_on = true, value_off = false, description = "Silence the alarm", }, } device.tuyaDatapoints = { { dp = 1, name = "gas", converter = "trueFalse0" }, { dp = 2, name = "gas_value", converter = "divideBy10" }, { dp = 10, name = "preheat", converter = "raw" }, { dp = 11, name = "fault_alarm", converter = "trueFalse1" }, { dp = 13, name = "alarm_switch", converter = "raw" }, { dp = 16, name = "silence", converter = "raw" }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE200_mby4kbtq", }, { model = "TS0601", manufacturer = "_TZE204_mby4kbtq", }, { model = "TS0601", manufacturer = "_TZE204_uo8qcagc", }, { model = "TS0601", manufacturer = "_TZE284_uo8qcagc", }, } return device