local device = {} device.model = "TS0601_switch_8_2" device.vendor = "Tuya" device.description = "8 gang switch" device.exposes = { { 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 = "switch", endpoint = "l4", features = { { type = "binary", name = "state", property = "state_l4", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", endpoint = "l4", }, }, }, { type = "switch", endpoint = "l5", features = { { type = "binary", name = "state", property = "state_l5", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", endpoint = "l5", }, }, }, { type = "switch", endpoint = "l6", features = { { type = "binary", name = "state", property = "state_l6", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", endpoint = "l6", }, }, }, { type = "switch", endpoint = "l7", features = { { type = "binary", name = "state", property = "state_l7", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", endpoint = "l7", }, }, }, { type = "switch", endpoint = "l8", features = { { type = "binary", name = "state", property = "state_l8", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", endpoint = "l8", }, }, }, { 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 = "numeric", name = "countdown", property = "countdown_l3", access = 3, unit = "s", min = 0, max = 43200, value_step = 1, description = "Countdown to turn device off after a certain time", endpoint = "l3", }, { type = "numeric", name = "countdown", property = "countdown_l4", access = 3, unit = "s", min = 0, max = 43200, value_step = 1, description = "Countdown to turn device off after a certain time", endpoint = "l4", }, { type = "numeric", name = "countdown", property = "countdown_l5", access = 3, unit = "s", min = 0, max = 43200, value_step = 1, description = "Countdown to turn device off after a certain time", endpoint = "l5", }, { type = "numeric", name = "countdown", property = "countdown_l6", access = 3, unit = "s", min = 0, max = 43200, value_step = 1, description = "Countdown to turn device off after a certain time", endpoint = "l6", }, { type = "numeric", name = "countdown", property = "countdown_l7", access = 3, unit = "s", min = 0, max = 43200, value_step = 1, description = "Countdown to turn device off after a certain time", endpoint = "l7", }, { type = "numeric", name = "countdown", property = "countdown_l8", access = 3, unit = "s", min = 0, max = 43200, value_step = 1, description = "Countdown to turn device off after a certain time", endpoint = "l8", }, { 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" }, }, } device.tuyaDatapoints = { { dp = 1, name = "state_l1", converter = "onOff" }, { dp = 2, name = "state_l2", converter = "onOff" }, { dp = 3, name = "state_l3", converter = "onOff" }, { dp = 4, name = "state_l4", converter = "onOff" }, { dp = 5, name = "state_l5", converter = "onOff" }, { dp = 6, name = "state_l6", converter = "onOff" }, { dp = 7, name = "state_l7", converter = "onOff" }, { dp = 8, name = "state_l8", converter = "onOff" }, { dp = 9, name = "countdown_l1", converter = "countdown" }, { dp = 10, name = "countdown_l2", converter = "countdown" }, { dp = 11, name = "countdown_l3", converter = "countdown" }, { dp = 12, name = "countdown_l4", converter = "countdown" }, { dp = 13, name = "countdown_l5", converter = "countdown" }, { dp = 14, name = "countdown_l6", converter = "countdown" }, { dp = 15, name = "countdown_l7", converter = "countdown" }, { dp = 16, name = "countdown_l8", converter = "countdown" }, { dp = 27, name = "power_on_behavior", converter = "powerOnBehaviorEnum" }, } device.meta = { multiEndpoint = true } device.endpoint = { l1 = 1, l2 = 1, l3 = 1, l4 = 1, l5 = 1, l6 = 1, l7 = 1, l8 = 1, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE204_adlblwab", }, } return device