local device = {} device.model = "TS0601_dimmer_4" device.vendor = "Tuya" device.description = "2 gang smart 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 = 3, min = 1, max = 255, description = "Minimum light brightness", endpoint = "l1", }, { type = "numeric", name = "max_brightness", property = "max_brightness_l1", access = 3, min = 1, max = 255, description = "Maximum 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 = 3, min = 1, max = 255, description = "Minimum light brightness", endpoint = "l2", }, { type = "numeric", name = "max_brightness", property = "max_brightness_l2", access = 3, min = 1, max = 255, description = "Maximum light brightness", endpoint = "l2", }, }, }, { type = "numeric", name = "countdown", property = "countdown_l1", access = 3, unit = "s", min = 0, max = 43200, value_step = 1, description = "Countdown to turn device off after a certain time", endpoint = "l1", }, { type = "numeric", name = "countdown", property = "countdown_l2", access = 3, unit = "s", min = 0, max = 43200, value_step = 1, description = "Countdown to turn device off after a certain time", endpoint = "l2", }, { type = "enum", name = "light_type", property = "light_type_l1", access = 3, description = "Type of light attached to the device", endpoint = "l1", values = { "led", "incandescent", "halogen" }, }, { type = "enum", name = "light_type", property = "light_type_l2", access = 3, description = "Type of light attached to the device", endpoint = "l2", values = { "led", "incandescent", "halogen" }, }, { 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 = 4, name = "light_type_l1", converter = "lookup", lookup = { led = 0, incandescent = 1, halogen = 2 } }, { dp = 5, name = "max_brightness_l1", converter = "scale0_254to0_1000" }, { dp = 6, name = "countdown_l1", converter = "countdown" }, { 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 = 10, name = "light_type_l2", converter = "lookup", lookup = { led = 0, incandescent = 1, halogen = 2 } }, { dp = 11, name = "max_brightness_l2", converter = "scale0_254to0_1000" }, { dp = 12, name = "countdown_l2", converter = "countdown" }, { dp = 14, name = "power_on_behavior", converter = "lookup", lookup = { off = 0, on = 1, previous = 2 } }, } device.meta = { multiEndpoint = true } device.endpoint = { l1 = 1, l2 = 1, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE200_bxoo2swd", }, { model = "TS0601", manufacturer = "_TZE204_bxoo2swd", }, { model = "TS0601", manufacturer = "_TZE200_tsxpl0d0", }, } return device