local device = {} device.model = "YXZBRB58" device.vendor = "Tuya" device.description = "Smart human presence sensor" 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 = "target_distance", property = "target_distance", access = 1, unit = "m", description = "Distance to target", }, { type = "numeric", name = "radar_sensitivity", property = "radar_sensitivity", access = 3, min = 0, max = 9, value_step = 1, description = "Sensitivity of the radar", }, { type = "numeric", name = "minimum_range", property = "minimum_range", access = 3, unit = "m", min = 0, max = 10, value_step = 0.1, description = "Minimum range", }, { type = "numeric", name = "maximum_range", property = "maximum_range", access = 3, unit = "m", min = 0, max = 10, value_step = 0.1, description = "Maximum range", }, { type = "numeric", name = "detection_delay", property = "detection_delay", access = 3, unit = "s", min = 0, max = 10, value_step = 0.1, description = "Detection delay", }, { type = "numeric", name = "fading_time", property = "fading_time", access = 3, unit = "s", min = 0, max = 1500, value_step = 1, description = "Fading time", }, { type = "enum", name = "radar_scene", property = "radar_scene", access = 3, description = "Presets for sensitivity for presence and movement", values = { "default", "bathroom", "bedroom", "sleeping", "unknown" }, }, { 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 = 1, name = "presence", converter = "trueFalse1" }, { dp = 2, name = "radar_sensitivity", converter = "raw" }, { dp = 3, name = "minimum_range", converter = "divideBy100" }, { dp = 4, name = "maximum_range", converter = "divideBy100" }, { dp = 101, name = "illuminance", converter = "raw" }, { dp = 102, name = "detection_delay", converter = "divideBy10" }, { dp = 103, name = "fading_time", converter = "divideBy10" }, { dp = 104, name = "radar_scene", converter = "lookup", lookup = { default = 0, bathroom = 1, bedroom = 2, sleeping = 3, unknown = 4 } }, { dp = 105, name = "target_distance", converter = "divideBy100" }, } 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_sooucan5", }, { model = "TS0601", manufacturer = "_TZE204_oqtpvx51", }, } return device