local device = {} device.model = "QADZ4DIN" device.vendor = "QA" device.description = "4 channel dimmer module" device.exposes = { { type = "light", endpoint = "l1", features = { { type = "binary", name = "state", property = "state_l1", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of this light", endpoint = "l1", }, { type = "numeric", name = "brightness", property = "brightness_l1", access = 3, min = 0, max = 254, description = "Brightness of this light", endpoint = "l1", }, { type = "numeric", name = "min_brightness", property = "min_brightness_l1", access = 7, min = 1, max = 255, description = "Minimum light brightness", endpoint = "l1", }, }, }, { type = "light", endpoint = "l2", features = { { type = "binary", name = "state", property = "state_l2", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of this light", endpoint = "l2", }, { type = "numeric", name = "brightness", property = "brightness_l2", access = 3, min = 0, max = 254, description = "Brightness of this light", endpoint = "l2", }, { type = "numeric", name = "min_brightness", property = "min_brightness_l2", access = 7, min = 1, max = 255, description = "Minimum light brightness", endpoint = "l2", }, }, }, { type = "light", endpoint = "l3", features = { { type = "binary", name = "state", property = "state_l3", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of this light", endpoint = "l3", }, { type = "numeric", name = "brightness", property = "brightness_l3", access = 3, min = 0, max = 254, description = "Brightness of this light", endpoint = "l3", }, { type = "numeric", name = "min_brightness", property = "min_brightness_l3", access = 7, min = 1, max = 255, description = "Minimum light brightness", endpoint = "l3", }, }, }, { type = "light", endpoint = "l4", features = { { type = "binary", name = "state", property = "state_l4", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of this light", endpoint = "l4", }, { type = "numeric", name = "brightness", property = "brightness_l4", access = 3, min = 0, max = 254, description = "Brightness of this light", endpoint = "l4", }, { type = "numeric", name = "min_brightness", property = "min_brightness_l4", access = 7, min = 1, max = 255, description = "Minimum light brightness", endpoint = "l4", }, }, }, { type = "enum", name = "switch_type", property = "switch_type", access = 3, description = "Type of the switch", category = "config", values = { "momentary", "toggle" }, }, { type = "enum", name = "dimming_speed", property = "dimming_speed", access = 3, description = "Dimming speed", category = "config", values = { "slow", "middle", "fast" }, }, { type = "enum", name = "power_on_behavior", property = "power_on_behavior", access = 3, values = { "off", "on", "previous" }, }, } device.tuyaDatapoints = { { dp = 1, name = "state_l1", converter = "onOff" }, { dp = 2, name = "brightness_l1", converter = "scale0_254to0_1000" }, { dp = 3, name = "min_brightness_l1", converter = "scale0_254to0_1000" }, { dp = 7, name = "state_l2", converter = "onOff" }, { dp = 8, name = "brightness_l2", converter = "scale0_254to0_1000" }, { dp = 9, name = "min_brightness_l2", converter = "scale0_254to0_1000" }, { dp = 14, name = "power_on_behavior", converter = "powerOnBehaviorEnum" }, { dp = 15, name = "state_l3", converter = "onOff" }, { dp = 16, name = "brightness_l3", converter = "scale0_254to0_1000" }, { dp = 17, name = "min_brightness_l3", converter = "scale0_254to0_1000" }, { dp = 101, name = "state_l4", converter = "onOff" }, { dp = 102, name = "brightness_l4", converter = "scale0_254to0_1000" }, { dp = 103, name = "min_brightness_l4", converter = "scale0_254to0_1000" }, { dp = 105, name = "dimming_speed", converter = "lookup", lookup = { slow = 0, middle = 1, fast = 2 } }, { dp = 106, name = "switch_type", converter = "switchType" }, } device.meta = { multiEndpoint = true } device.endpoint = { l1 = 1, l2 = 1, l3 = 1, l4 = 1, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE284_nthhgkd6", }, } return device