local device = {} device.model = "TS0601_3gang_rkbxtclc" device.vendor = "Tuya" device.description = "Three gang smart switch with colored backlight modes" device.exposes = { { type = "switch", description = "All switches", features = { { type = "binary", name = "state", property = "state", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", }, }, }, { type = "switch", endpoint = "l1", features = { { type = "binary", name = "state", property = "state_l1", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", endpoint = "l1", }, }, }, { type = "switch", endpoint = "l2", features = { { type = "binary", name = "state", property = "state_l2", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", endpoint = "l2", }, }, }, { type = "switch", endpoint = "l3", features = { { type = "binary", name = "state", property = "state_l3", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", endpoint = "l3", }, }, }, { type = "binary", name = "backlight_switch", property = "backlight_switch", access = 3, value_on = "ON", value_off = "OFF", description = "Backlight master switch", }, { type = "numeric", name = "backlight", property = "backlight", access = 3, unit = "%", min = 0, max = 100, description = "Backlight brightness percentage", }, { type = "enum", name = "indicator_mode", property = "indicator_mode", access = 3, description = "LED indicator mode", values = { "off", "on_off_status", "switch_position" }, }, { type = "enum", name = "power_on_behavior", property = "power_on_behavior", access = 3, description = "Controls the behavior when the device is powered on after power loss", category = "config", values = { "off", "previous", "on" }, }, { type = "binary", name = "child_lock", property = "child_lock", access = 3, value_on = "ON", value_off = "OFF", description = "Child lock", }, { type = "enum", name = "on_color", property = "on_color", access = 3, description = "ON color", values = { "red", "blue", "green", "white", "yellow", "magenta", "cyan", "warm_white", "warm_yellow", }, }, { type = "enum", name = "off_color", property = "off_color", access = 3, description = "OFF color", values = { "red", "blue", "green", "white", "yellow", "magenta", "cyan", "warm_white", "warm_yellow", }, }, { type = "numeric", name = "countdown_l1", property = "countdown_l1", access = 3, unit = "s", min = 0, max = 86400, description = "Countdown for l1", }, { type = "numeric", name = "countdown_l2", property = "countdown_l2", access = 3, unit = "s", min = 0, max = 86400, description = "Countdown for l2", }, { type = "numeric", name = "countdown_l3", property = "countdown_l3", access = 3, unit = "s", min = 0, max = 86400, description = "Countdown for l3", }, } device.tuyaDatapoints = { { dp = 13, name = "state", converter = "onOff" }, { dp = 1, name = "state_l1", converter = "onOff" }, { dp = 2, name = "state_l2", converter = "onOff" }, { dp = 3, name = "state_l3", converter = "onOff" }, { dp = 7, name = "countdown_l1", converter = "countdown" }, { dp = 8, name = "countdown_l2", converter = "countdown" }, { dp = 9, name = "countdown_l3", converter = "countdown" }, { dp = 14, name = "power_on_behavior", converter = "powerOnBehaviorEnum" }, { dp = 15, name = "indicator_mode", converter = "lookup", lookup = { off = 0, on_off_status = 1, switch_position = 2 } }, { dp = 16, name = "backlight_switch", converter = "onOff" }, { dp = 101, name = "child_lock", converter = "onOff" }, { dp = 102, name = "backlight", converter = "raw" }, { dp = 103, name = "on_color", converter = "lookup", lookup = { red = 0, blue = 1, green = 2, white = 3, yellow = 4, magenta = 5, cyan = 6, warm_white = 7, warm_yellow = 8 } }, { dp = 104, name = "off_color", converter = "lookup", lookup = { red = 0, blue = 1, green = 2, white = 3, yellow = 4, magenta = 5, cyan = 6, warm_white = 7, warm_yellow = 8 } }, } device.meta = { multiEndpoint = true } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE204_rkbxtclc", }, } return device