local device = {} device.model = "ZG-205Z" device.vendor = "Tuya" device.description = "5.8 GHz human presence sensor" 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 = "presence_state", property = "presence_state", access = 1, description = "The presence state", values = { "none", "presence", "peaceful", "small_movement", "large_movement" }, }, { type = "numeric", name = "target_distance", property = "target_distance", access = 1, unit = "m", min = 0, max = 10, value_step = 0.01, description = "Target distance", }, { type = "numeric", name = "illuminance", property = "illuminance", access = 1, unit = "lx", description = "Measured illuminance", }, { type = "binary", name = "indicator", property = "indicator", access = 3, value_on = "ON", value_off = "OFF", description = "LED Indicator", }, { type = "numeric", name = "none_delay_time", property = "none_delay_time", access = 3, unit = "Sec", min = 0, max = 28800, value_step = 1, description = "Hold delay time", }, { type = "numeric", name = "move_detection_max", property = "move_detection_max", access = 3, unit = "m", min = 0, max = 10, value_step = 0.01, description = "Move detection max distance", }, { type = "numeric", name = "move_detection_min", property = "move_detection_min", access = 3, unit = "m", min = 0, max = 10, value_step = 0.01, description = "Move detection min distance", }, { type = "numeric", name = "small_move_detection_max", property = "small_move_detection_max", access = 3, unit = "m", min = 0, max = 6, value_step = 0.01, description = "Small move detection max distance", }, { type = "numeric", name = "small_move_detection_min", property = "small_move_detection_min", access = 3, unit = "m", min = 0, max = 6, value_step = 0.01, description = "Small move detection min distance", }, { type = "numeric", name = "breath_detection_max", property = "breath_detection_max", access = 3, unit = "m", min = 0, max = 6, value_step = 0.01, description = "Breath detection max distance", }, { type = "numeric", name = "breath_detection_min", property = "breath_detection_min", access = 3, unit = "m", min = 0, max = 6, value_step = 0.01, description = "Breath detection min distance", }, { type = "numeric", name = "move_sensitivity", property = "move_sensitivity", access = 3, min = 0, max = 10, value_step = 1, description = "Move sensitivity", }, { type = "numeric", name = "breath_sensitivity", property = "breath_sensitivity", access = 3, min = 0, max = 10, value_step = 1, description = "Breath sensitivity", }, { type = "numeric", name = "small_move_sensitivity", property = "small_move_sensitivity", access = 3, min = 0, max = 10, value_step = 1, description = "Small Move sensitivity", }, { 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 = 101, name = "target_distance", converter = "divideBy100" }, { dp = 102, name = "illuminance", converter = "raw" }, { dp = 103, name = "none_delay_time", converter = "raw" }, { dp = 104, name = "indicator", converter = "onOff" }, { dp = 107, name = "move_detection_max", converter = "divideBy100" }, { dp = 108, name = "move_detection_min", converter = "divideBy100" }, { dp = 109, name = "breath_detection_max", converter = "divideBy100" }, { dp = 110, name = "breath_detection_min", converter = "divideBy100" }, { dp = 114, name = "small_move_detection_max", converter = "divideBy100" }, { dp = 115, name = "small_move_detection_min", converter = "divideBy100" }, { dp = 116, name = "move_sensitivity", converter = "raw" }, { dp = 117, name = "small_move_sensitivity", converter = "raw" }, { dp = 118, name = "breath_sensitivity", converter = "raw" }, } 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, }, }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE204_dapwryy7", }, } return device