local device = {} device.model = "RT_ZCZ03Z" device.vendor = "Tuya" device.description = "Human presence sensor 24G" device.exposes = { { type = "numeric", name = "illuminance", property = "illuminance", access = 1, unit = "lx", description = "Measured illuminance", }, { type = "binary", name = "presence", property = "presence", access = 1, value_on = true, value_off = false, description = "Indicates whether the device detected presence", }, { type = "numeric", name = "detection_distance_max", property = "detection_distance_max", access = 3, unit = "cm", min = 0, max = 840, value_step = 1, description = "Max detection distance", }, { type = "numeric", name = "detection_distance_min", property = "detection_distance_min", access = 3, unit = "cm", min = 0, max = 840, value_step = 1, description = "Min detection distance", }, { type = "numeric", name = "target_distance", property = "target_distance", access = 1, unit = "cm", description = "Distance to target", }, { type = "numeric", name = "fading_time", property = "fading_time", access = 3, unit = "s", min = 1, max = 59, value_step = 1, description = "Delay time", }, { type = "numeric", name = "presence_sensitivity", property = "presence_sensitivity", access = 3, min = 1, max = 10, value_step = 1, description = "Presence sensitivity", }, { type = "binary", name = "indicator", property = "indicator", access = 3, value_on = "ON", value_off = "OFF", description = "LED Indicator", }, { 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 = "tamper", property = "tamper", access = 1, value_on = true, value_off = false, description = "Indicates whether the device is tampered", }, { 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 = { "illuminance", "ias_zone", "occupancy" } device.tuyaDatapoints = { { dp = 101, name = "target_distance", converter = "raw" }, { dp = 102, name = "illuminance", converter = "raw" }, { dp = 103, name = "fading_time", converter = "raw" }, { dp = 104, name = "indicator", converter = "onOff" }, { dp = 107, name = "detection_distance_max", converter = "raw" }, { dp = 108, name = "detection_distance_min", converter = "raw" }, { dp = 111, name = "presence_sensitivity", converter = "raw" }, } device.configure = { bind = { "msIlluminanceMeasurement", "ssIasZone", "msOccupancySensing" }, reporting = { { cluster = "msIlluminanceMeasurement", attribute = "measuredValue", min = 10, max = 3600, change = 5, }, { cluster = "msOccupancySensing", attribute = "occupancy", min = 0, max = 3600, change = 0, }, }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE204_uxllnywp", }, } return device