local device = {} device.model = "E2134" device.vendor = "IKEA" device.description = "VALLHORN wireless motion sensor" device.zigbeeModel = { "VALLHORN Wireless Motion Sensor" } device.exposes = { { type = "binary", name = "occupancy", property = "occupancy", access = 5, value_on = true, value_off = false, description = "Indicates whether the device detected occupancy", }, { type = "numeric", name = "illuminance", property = "illuminance", access = 5, unit = "lx", description = "Measured illuminance", }, { type = "enum", name = "identify", property = "identify", access = 2, description = "Initiate device identification. This device is asleep by default.You may need to wake it up first before sending the identify command.", category = "config", values = { "identify" }, }, { type = "numeric", name = "battery", property = "battery", access = 5, unit = "%", min = 0, max = 100, description = "Remaining battery in %", category = "diagnostic", }, { type = "numeric", name = "voltage", property = "voltage", access = 5, unit = "mV", description = "Reported battery voltage in millivolts", category = "diagnostic", }, { 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 = { "occupancy", "illuminance", "battery", "ias_zone", "electrical" } device.configure = { bind = { "msOccupancySensing", "msIlluminanceMeasurement", "genPowerCfg", "ssIasZone", "haElectricalMeasurement" }, reporting = { { cluster = "msOccupancySensing", attribute = "occupancy", min = 0, max = 3600, change = 0, }, { cluster = "msIlluminanceMeasurement", attribute = "measuredValue", min = 10, max = 3600, change = 5, }, { cluster = "genPowerCfg", attribute = "batteryPercentageRemaining", min = 3600, max = 65000, change = 0, }, { cluster = "genPowerCfg", attribute = "batteryVoltage", min = 3600, max = 65000, change = 0, }, { cluster = "haElectricalMeasurement", attribute = "activePower", min = 5, max = 3600, change = 1, }, { cluster = "haElectricalMeasurement", attribute = "rmsVoltage", min = 5, max = 3600, change = 5, }, { cluster = "haElectricalMeasurement", attribute = "rmsCurrent", min = 5, max = 3600, change = 100, }, }, } return device