local device = {} device.model = "ZG-204ZV" device.vendor = "HOBEIAN" device.description = "Millimeter wave motion detection" device.zigbeeModel = { "ZG-204ZV" } 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 = "temperature", property = "temperature", access = 1, unit = "°C", description = "Measured temperature value", }, { type = "numeric", name = "humidity", property = "humidity", access = 1, unit = "%", description = "Measured relative humidity", }, { type = "enum", name = "temperature_unit", property = "temperature_unit", access = 3, description = "Temperature unit", values = { "celsius", "fahrenheit" }, }, { type = "numeric", name = "temperature_calibration", property = "temperature_calibration", access = 3, unit = "°C", min = -2, max = 2, value_step = 0.1, description = "Temperature calibration", }, { type = "numeric", name = "humidity_calibration", property = "humidity_calibration", access = 3, unit = "%", min = -30, max = 30, value_step = 1, description = "Humidity calibration", }, { type = "numeric", name = "battery", property = "battery", access = 1, unit = "%", min = 0, max = 100, description = "Remaining battery in %, can take up to 24 hours before reported", category = "diagnostic", }, { type = "numeric", name = "fading_time", property = "fading_time", access = 3, unit = "s", min = 0, max = 28800, value_step = 1, description = "Motion keep time", }, { type = "binary", name = "indicator", property = "indicator", access = 3, value_on = "ON", value_off = "OFF", description = "LED indicator mode", }, { type = "numeric", name = "illuminance_interval", property = "illuminance_interval", access = 3, unit = "minutes", min = 1, max = 720, value_step = 1, description = "Light sensing sampling(refresh and update only while active)", }, { type = "numeric", name = "motion_detection_sensitivity", property = "motion_detection_sensitivity", access = 3, min = 0, max = 19, value_step = 1, description = "The larger the value, the more sensitive it is (refresh and update only while active)", }, { 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", "temperature", "humidity", "battery" } device.tuyaDatapoints = { { dp = 1, name = "presence", converter = "trueFalse1" }, { dp = 106, name = "illuminance", converter = "raw" }, { dp = 102, name = "fading_time", converter = "raw" }, { dp = 2, name = "motion_detection_sensitivity", converter = "raw" }, { dp = 108, name = "indicator", converter = "onOff" }, { dp = 110, name = "battery", converter = "raw" }, { dp = 111, name = "temperature", converter = "divideBy10" }, { dp = 101, name = "humidity", converter = "raw" }, { dp = 109, name = "temperature_unit", converter = "temperatureUnit" }, { dp = 105, name = "temperature_calibration", converter = "localTempCalibration3" }, { dp = 104, name = "humidity_calibration", converter = "localTempCalibration2" }, { dp = 107, name = "illuminance_interval", converter = "raw" }, } device.configure = { bind = { "ssIasZone", "msOccupancySensing", "msIlluminanceMeasurement", "msTemperatureMeasurement", "msRelativeHumidity", "genPowerCfg" }, reporting = { { cluster = "msOccupancySensing", attribute = "occupancy", min = 0, max = 3600, change = 0, }, { cluster = "msIlluminanceMeasurement", attribute = "measuredValue", min = 10, max = 3600, change = 5, }, { cluster = "msTemperatureMeasurement", attribute = "measuredValue", min = 10, max = 3600, change = 100, }, { cluster = "msRelativeHumidity", attribute = "measuredValue", min = 10, max = 3600, change = 100, }, { cluster = "genPowerCfg", attribute = "batteryPercentageRemaining", min = 3600, max = 65000, change = 0, }, { cluster = "genPowerCfg", attribute = "batteryVoltage", min = 3600, max = 65000, change = 0, }, }, } return device