local device = {} device.model = "TS0222_light" device.vendor = "Tuya" device.description = "Light sensor" device.exposes = { { 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 = "illuminance", property = "illuminance", access = 5, unit = "lx", description = "Measured illuminance", }, } device.fromZigbee = { "battery", "illuminance" } device.configure = { bind = { "genPowerCfg", "msIlluminanceMeasurement" }, reporting = { { cluster = "genPowerCfg", attribute = "batteryPercentageRemaining", min = 3600, max = 65000, change = 0, }, { cluster = "genPowerCfg", attribute = "batteryVoltage", min = 3600, max = 65000, change = 0, }, { cluster = "msIlluminanceMeasurement", attribute = "measuredValue", min = 10, max = 3600, change = 5, }, }, } device.fingerprint = { { model = "TS0222", manufacturer = "_TZ3000_8uxxzz4b", }, { model = "TS0222", manufacturer = "_TZ3000_9kbbfeho", }, { model = "TS0222", manufacturer = "_TZ3000_l6rsaipj", }, } return device