local device = {} device.model = "XFY-CGQ-ZIGB" device.vendor = "Tuya" device.description = "Illuminance sensor" device.fingerprint = { { model = "TS0601", manufacturer = "_TZE200_yi4jtqq1", }, { model = "TS0601", manufacturer = "_TZE200_khx7nnka", }, { model = "TS0601", manufacturer = "_TZE204_khx7nnka", }, } device.exposes = { { type = "numeric", name = "illuminance", property = "illuminance", access = 1, unit = "lx", description = "Measured illuminance", }, { type = "enum", name = "brightness_state", property = "brightness_state", access = 1, description = "Brightness state", values = { "low", "middle", "high", "strong" }, }, } device.fromZigbee = { "illuminance" } device.tuyaDatapoints = { { dp = 1, name = "brightness_state", converter = "lookup", lookup = { low = 0, middle = 1, high = 2, strong = 3 } }, { dp = 2, name = "illuminance", converter = "raw" }, } device.configure = { bind = { "msIlluminanceMeasurement" }, reporting = { { cluster = "msIlluminanceMeasurement", attribute = "measuredValue", min = 10, max = 3600, change = 5, }, }, } return device