local device = {} device.model = "ZG-205Z/A" device.vendor = "Tuya" device.description = "5.8Ghz/24Ghz 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 = "motion_state", property = "motion_state", access = 1, description = "State of the motion", values = { "none", "small", "medium", "large", "far", "near" }, }, { type = "numeric", name = "target_distance", property = "target_distance", access = 1, unit = "m", description = "Distance to target", }, { type = "numeric", name = "illuminance", property = "illuminance", access = 1, unit = "lx", description = "Measured illuminance", }, { type = "numeric", name = "large_motion_detection_sensitivity", property = "large_motion_detection_sensitivity", access = 3, min = 0, max = 10, value_step = 1, description = "Motion detection sensitivity", }, { 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 = "Motion detection distance", }, { type = "numeric", name = "fading_time", property = "fading_time", access = 3, unit = "s", min = 0, max = 28800, value_step = 1, description = "For how much time presence should stay true after detecting it", }, { type = "numeric", name = "medium_motion_detection_distance", property = "medium_motion_detection_distance", access = 3, unit = "m", min = 0, max = 6, value_step = 0.01, description = "Medium motion detection distance", }, { type = "numeric", name = "medium_motion_detection_sensitivity", property = "medium_motion_detection_sensitivity", access = 3, min = 0, max = 10, value_step = 1, description = "Medium motion detection sensitivity", }, { type = "binary", name = "indicator", property = "indicator", access = 3, value_on = "ON", value_off = "OFF", description = "LED Indicator", }, { type = "numeric", name = "small_detection_distance", property = "small_detection_distance", access = 3, unit = "m", min = 0, max = 6, value_step = 0.01, description = "Small detection distance", }, { type = "numeric", name = "small_detection_sensitivity", property = "small_detection_sensitivity", access = 3, min = 0, max = 10, value_step = 1, description = "Small detection sensitivity", }, { type = "numeric", name = "minimum_range", property = "minimum_range", access = 3, unit = "m", min = 0, max = 6, value_step = 0.01, description = "Minimum range", }, { 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 = 2, name = "large_motion_detection_sensitivity", converter = "raw" }, { dp = 4, name = "large_motion_detection_distance", converter = "divideBy100" }, { dp = 101, name = "motion_state", converter = "lookup", lookup = { none = 0, large = 1, medium = 2, small = 3, far = 4, near = 5 } }, { dp = 102, name = "fading_time", converter = "raw" }, { dp = 104, name = "medium_motion_detection_distance", converter = "divideBy100" }, { dp = 105, name = "medium_motion_detection_sensitivity", converter = "raw" }, { dp = 106, name = "illuminance", converter = "raw" }, { dp = 107, name = "indicator", converter = "onOff" }, { dp = 108, name = "small_detection_distance", converter = "divideBy100" }, { dp = 109, name = "small_detection_sensitivity", converter = "raw" }, { dp = 122, name = "target_distance", converter = "divideBy100" }, { dp = 123, name = "minimum_range", converter = "divideBy100" }, } 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 = "TS0225", manufacturer = "_TZE200_2aaelwxk", }, { model = "TS0225", manufacturer = "_TZE200_crq3r3la", }, { model = "CK-BL702-MWS-01(7016)", manufacturer = "HOBEIAN", }, { model = "CK-BL702-MWS-01(7016)", manufacturer = "_TZE200_crq3r3la", }, } return device