local device = {} device.model = "ZG-205ZL" device.vendor = "Tuya" device.description = "24Ghz/5.8GHz human presence sensor" device.zigbeeModel = { "ZG-205ZL" } device.exposes = { { type = "binary", name = "presence", property = "presence", access = 1, value_on = true, value_off = false, description = "Indicates whether the device detected presence", }, { type = "enum", name = "motion_state", property = "motion_state", access = 1, description = "Motion state", values = { "none", "large", "small", "static" }, }, { type = "numeric", name = "illuminance", property = "illuminance", access = 1, unit = "lx", description = "Measured illuminance", }, { type = "numeric", name = "fading_time", property = "fading_time", access = 3, unit = "s", min = 0, max = 3600, value_step = 1, description = "Presence keep time", }, { type = "numeric", name = "large_motion_detection_distance", property = "large_motion_detection_distance", access = 3, unit = "m", min = 0, max = 10, value_step = 0.01, description = "Large motion detection distance", }, { type = "numeric", name = "large_motion_detection_sensitivity", property = "large_motion_detection_sensitivity", access = 3, min = 0, max = 10, value_step = 1, description = "Large motion detection sensitivity", }, { type = "numeric", name = "small_motion_detection_distance", property = "small_motion_detection_distance", access = 3, unit = "m", min = 0, max = 6, value_step = 0.01, description = "Small motion detection distance", }, { type = "numeric", name = "small_motion_detection_sensitivity", property = "small_motion_detection_sensitivity", access = 3, min = 0, max = 10, value_step = 1, description = "Small motion detection sensitivity", }, { type = "numeric", name = "static_detection_distance", property = "static_detection_distance", access = 3, unit = "m", min = 0, max = 6, value_step = 0.01, description = "Static detection distance", }, { type = "numeric", name = "static_detection_sensitivity", property = "static_detection_sensitivity", access = 3, min = 0, max = 10, value_step = 1, description = "Static detection sensitivity", }, { type = "enum", name = "mode", property = "mode", access = 3, description = "Working mode", values = { "off", "arm", "alarm", "doorbell" }, }, { type = "enum", name = "alarm_volume", property = "alarm_volume", access = 3, description = "Alarm volume", values = { "mute", "low", "medium", "high" }, }, { type = "numeric", name = "alarm_time", property = "alarm_time", access = 3, unit = "m", min = 1, max = 60, value_step = 1, description = "Alarm time", }, { type = "binary", name = "light_mode", property = "light_mode", access = 3, value_on = "ON", value_off = "OFF", description = "LED indicator mode", }, { 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 = { "ias_zone", "occupancy", "illuminance" } device.tuyaDatapoints = { { dp = 1, name = "presence", converter = "trueFalse1" }, { dp = 20, name = "illuminance", converter = "raw" }, { dp = 11, name = "motion_state", converter = "lookup", lookup = { none = 0, large = 1, small = 2, static = 3, far = 4, near = 5 } }, { dp = 12, name = "fading_time", converter = "raw" }, { dp = 13, name = "large_motion_detection_distance", converter = "divideBy100" }, { dp = 15, name = "large_motion_detection_sensitivity", converter = "raw" }, { dp = 14, name = "small_motion_detection_distance", converter = "divideBy100" }, { dp = 16, name = "small_motion_detection_sensitivity", converter = "raw" }, { dp = 103, name = "static_detection_distance", converter = "divideBy100" }, { dp = 104, name = "static_detection_sensitivity", converter = "raw" }, { dp = 105, name = "mode", converter = "lookup", lookup = { arm = 0, off = 1, alarm = 2, doorbell = 3 } }, { dp = 102, name = "alarm_volume", converter = "lookup", lookup = { low = 0, medium = 1, high = 2, mute = 3 } }, { dp = 101, name = "alarm_time", converter = "raw" }, { dp = 24, name = "light_mode", converter = "onOff" }, } device.configure = { bind = { "ssIasZone", "msOccupancySensing", "msIlluminanceMeasurement" }, reporting = { { cluster = "msOccupancySensing", attribute = "occupancy", min = 0, max = 3600, change = 0, }, { cluster = "msIlluminanceMeasurement", attribute = "measuredValue", min = 10, max = 3600, change = 5, }, }, } return device