local device = {} device.model = "PM2.5_airbox" device.vendor = "Tuya" device.description = "PM2.5 air quality sensor" device.exposes = { { type = "numeric", name = "pm25", property = "pm25", access = 1, unit = "µg/m³", min = 0, max = 999, value_step = 1, description = "Measured PM2.5 (particulate matter) concentration", }, { type = "numeric", name = "temperature", property = "temperature", access = 1, unit = "°C", description = "Measured temperature value", }, { type = "numeric", name = "humidity", property = "humidity", access = 1, unit = "%", description = "Measured relative humidity", }, { type = "numeric", name = "co2", property = "co2", access = 1, unit = "ppm", description = "The measured CO2 (carbon dioxide) value", }, { type = "numeric", name = "voc", property = "voc", access = 1, unit = "ppb", description = "Measured VOC value", }, { type = "numeric", name = "formaldehyd", property = "formaldehyd", access = 1, unit = "µg/m³", description = "The measured formaldehyd value", }, } device.fromZigbee = { "pm25", "temperature", "humidity", "co2" } device.tuyaDatapoints = { { dp = 2, name = "co2", converter = "raw" }, { dp = 18, name = "temperature", converter = "divideBy10" }, { dp = 19, name = "humidity", converter = "divideBy10" }, { dp = 20, name = "co2", converter = "raw" }, { dp = 21, name = "voc", converter = "divideBy100" }, { dp = 22, name = "formaldehyd", converter = "divideBy100" }, } device.configure = { bind = { "msTemperatureMeasurement", "msRelativeHumidity" }, reporting = { { cluster = "msTemperatureMeasurement", attribute = "measuredValue", min = 10, max = 3600, change = 100, }, { cluster = "msRelativeHumidity", attribute = "measuredValue", min = 10, max = 3600, change = 100, }, }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE284_it9utkro", }, } return device