local device = {} device.model = "ZY-M100-24G" device.vendor = "Tuya" device.description = "24G MmWave radar human presence motion sensor" device.exposes = { { type = "enum", name = "state", property = "state", access = 1, description = "Presence state", values = { "none", "presence", "move" }, }, { type = "binary", name = "presence", property = "presence", access = 1, value_on = true, value_off = false, description = "Indicates whether the device detected presence", }, { type = "numeric", name = "distance", property = "distance", access = 1, unit = "m", description = "Target distance", }, { type = "numeric", name = "illuminance", property = "illuminance", access = 1, unit = "lx", description = "Measured illuminance", }, { type = "numeric", name = "motion_sensitivity", property = "motion_sensitivity", access = 3, min = 1, max = 10, value_step = 1, description = "Motion sensitivity", category = "config", }, { type = "numeric", name = "presence_sensitivity", property = "presence_sensitivity", access = 3, min = 1, max = 10, value_step = 1, description = "Presence sensitivity", category = "config", }, { type = "numeric", name = "max_range", property = "max_range", access = 3, unit = "m", min = 1.5, max = 5.5, value_step = 1, description = "Maximum range", category = "config", }, { type = "numeric", name = "presence_timeout", property = "presence_timeout", access = 3, unit = "s", min = 1, max = 1500, value_step = 1, description = "Presence timeout", }, { 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 = 112, name = "presence", converter = "trueFalse1" }, { dp = 106, name = "motion_sensitivity", converter = "divideBy10FromOnly" }, { dp = 111, name = "presence_sensitivity", converter = "divideBy10FromOnly" }, { dp = 107, name = "max_range", converter = "divideBy100" }, { dp = 109, name = "distance", converter = "divideBy100" }, { dp = 110, name = "presence_timeout", converter = "raw" }, { dp = 104, name = "illuminance", converter = "raw" }, { dp = 102, name = "illuminance_treshold_max", converter = "raw" }, { dp = 103, name = "illuminance_treshold_min", converter = "raw" }, { dp = 105, name = "state", converter = "lookup", lookup = { none = 0, presence = 1, move = 2 } }, } 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.meta = { multiEndpoint = true } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE204_ijxvkhd0", }, } return device