local device = {} device.model = "MTG075-ZB-RL" device.vendor = "Tuya" device.description = "2.4G/5.8G human presence sensor with relay" device.exposes = { { type = "binary", name = "presence", property = "presence", access = 1, value_on = true, value_off = false, description = "Indicates whether the device detected presence", }, { type = "numeric", name = "illuminance", property = "illuminance", access = 1, unit = "lx", description = "Measured illuminance", }, { 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 = "Detection threshold for the strength of object energy", }, { type = "numeric", name = "detection_range", property = "detection_range", access = 3, unit = "m", min = 0, max = 8, value_step = 0.1, description = "Maximum distance detected by the sensor", }, { type = "numeric", name = "shield_range", property = "shield_range", access = 3, unit = "m", min = 0, max = 8, value_step = 0.1, description = "Nearest distance detected by the sensor", }, { type = "numeric", name = "entry_sensitivity", property = "entry_sensitivity", access = 3, min = 0, max = 9, value_step = 1, description = "Sensitivity threshold triggered for the first time when the target enters the detection range", }, { type = "numeric", name = "entry_distance_indentation", property = "entry_distance_indentation", access = 3, unit = "m", min = 0, max = 8, value_step = 0.1, description = "Indent the distance inward based on the detection distance", }, { type = "numeric", name = "entry_filter_time", property = "entry_filter_time", access = 3, unit = "s", min = 0, max = 10, value_step = 0.1, description = "Sensitivity threshold triggered for the first time when the target enters the detection range ", }, { type = "numeric", name = "departure_delay", property = "departure_delay", access = 3, unit = "s", min = 0, max = 600, value_step = 1, description = "Confirmation time after the target disappears", }, { type = "numeric", name = "block_time", property = "block_time", access = 3, unit = "s", min = 0, max = 10, value_step = 0.1, description = "Time for the target to be detected again after switching from manned(occupy) to unmanned(unoccupy) mode", }, { type = "binary", name = "breaker_status", property = "breaker_status", access = 3, value_on = "ON", value_off = "OFF", description = "Remotely control the breaker in standard mode", }, { type = "enum", name = "breaker_mode", property = "breaker_mode", access = 3, description = "Breaker mode: standard is remotely controlled, local is automatic", values = { "standard", "local" }, }, { type = "numeric", name = "illuminance_threshold", property = "illuminance_threshold", access = 3, unit = "lx", min = 0, max = 420, value_step = 0.1, description = "Illumination threshold for local (automatic) switching mode operation", }, { type = "enum", name = "status_indication", property = "status_indication", access = 3, description = "Indicator light will flash when human presence is detected", values = { "OFF", "ON" }, }, { type = "enum", name = "sensor", property = "sensor", access = 3, description = "The radar sensor can be set in four states: on, off, occupied and unoccupied. For example, if set to occupied, it will continue to maintain presence regardless of whether someone is present or not. If set to unoccupied, the unoccupied state will be maintained permanently.", values = { "on", "off", "occupied", "unoccupied" }, }, { 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 = "radar_sensitivity", converter = "raw" }, { dp = 3, name = "shield_range", converter = "divideBy100" }, { dp = 4, name = "detection_range", converter = "divideBy100" }, { dp = 6, name = "equipment_status", converter = "raw" }, { dp = 9, name = "target_distance", converter = "divideBy100" }, { dp = 101, name = "entry_filter_time", converter = "divideBy10" }, { dp = 102, name = "departure_delay", converter = "raw" }, { dp = 103, name = "cline", converter = "raw" }, { dp = 104, name = "illuminance", converter = "divideBy10" }, { dp = 105, name = "entry_sensitivity", converter = "raw" }, { dp = 106, name = "entry_distance_indentation", converter = "divideBy100" }, { dp = 107, name = "breaker_mode", converter = "lookup", lookup = { standard = 0, local = 1 } }, { dp = 108, name = "breaker_status", converter = "lookup", lookup = { OFF = 0, ON = 1 } }, { dp = 109, name = "status_indication", converter = "lookup", lookup = { OFF = 0, ON = 1 } }, { dp = 110, name = "illuminance_threshold", converter = "divideBy10" }, { dp = 111, name = "breaker_polarity", converter = "lookup", lookup = { NC = 0, NO = 1 } }, { dp = 112, name = "block_time", converter = "divideBy10" }, { dp = 113, name = "parameter_setting_result", converter = "raw" }, { dp = 114, name = "factory_parameters", converter = "raw" }, { dp = 115, name = "sensor", converter = "lookup", lookup = { on = 0, off = 1, occupied = 2, unoccupied = 3 } }, } 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_sbyx0lm6", }, { model = "TS0601", manufacturer = "_TZE204_clrdrnya", }, { model = "TS0601", manufacturer = "_TZE204_dtzziy1e", }, { model = "TS0601", manufacturer = "_TZE204_iaeejhvf", }, { model = "TS0601", manufacturer = "_TZE204_mtoaryre", }, { model = "TS0601", manufacturer = "_TZE200_mp902om5", }, { model = "TS0601", manufacturer = "_TZE204_pfayrzcw", }, { model = "TS0601", manufacturer = "_TZE284_4qznlkbu", }, { model = "TS0601", manufacturer = "_TZE200_clrdrnya", }, { model = "TS0601", manufacturer = "_TZE200_sbyx0lm6", }, } return device