local device = {} device.model = "ZY-M100-24GV3" device.vendor = "Tuya" device.description = "24G MmWave radar human presence motion sensor (added distance switch)" device.exposes = { { type = "enum", name = "state", property = "state", access = 1, description = "Presence state sensor", values = { "none", "presence", "move" }, }, { type = "binary", name = "presence", property = "presence", access = 1, value_on = true, value_off = false, description = "Occupancy", }, { type = "numeric", name = "distance", property = "distance", access = 1, unit = "m", description = "Target distance", }, { type = "binary", name = "find_switch", property = "find_switch", access = 3, value_on = "ON", value_off = "OFF", description = "distance switch", }, { type = "numeric", name = "illuminance", property = "illuminance", access = 1, unit = "lx", description = "Illuminance sensor", }, { type = "numeric", name = "move_sensitivity", property = "move_sensitivity", access = 3, min = 1, max = 10, value_step = 1, description = "Motion Sensitivity", }, { type = "numeric", name = "presence_sensitivity", property = "presence_sensitivity", access = 3, min = 1, max = 10, value_step = 1, description = "Presence Sensitivity", }, { type = "numeric", name = "presence_timeout", property = "presence_timeout", access = 3, unit = "s", min = 1, max = 15000, value_step = 1, description = "Fade time", }, { type = "numeric", name = "detection_distance_min", property = "detection_distance_min", access = 3, unit = "m", min = 0, max = 6, value_step = 0.5, description = "Minimum range", }, { type = "numeric", name = "detection_distance_max", property = "detection_distance_max", access = 3, unit = "m", min = 0.5, max = 9, value_step = 0.5, description = "Maximum 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 = 2, name = "move_sensitivity", converter = "raw" }, { dp = 3, name = "detection_distance_min", converter = "divideBy100" }, { dp = 4, name = "detection_distance_max", converter = "divideBy100" }, { dp = 9, name = "distance", converter = "divideBy10" }, { dp = 101, name = "find_switch", converter = "onOff" }, { dp = 102, name = "presence_sensitivity", converter = "raw" }, { dp = 103, name = "illuminance", converter = "raw" }, { dp = 105, name = "presence_timeout", 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_ya4ft0w4", }, { model = "TS0601", manufacturer = "_TZE200_ya4ft0w4", }, { model = "TS0601", manufacturer = "_TZE204_gkfbdvyx", }, { model = "TS0601", manufacturer = "_TZE200_gkfbdvyx", }, } return device