local device = {} device.model = "TS0601_dimmer_1_gang_2" device.vendor = "Tuya" device.description = "1 gang smart dimmer" device.exposes = { { type = "light", features = { { type = "binary", name = "state", property = "state", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of this light", }, { type = "numeric", name = "brightness", property = "brightness", access = 3, min = 0, max = 254, description = "Brightness of this light", }, }, }, { type = "numeric", name = "countdown", property = "countdown", access = 3, unit = "s", min = 0, max = 43200, value_step = 1, description = "Countdown to turn device off after a certain time", }, { type = "enum", name = "light_type", property = "light_type", access = 3, description = "Type of light attached to the device", values = { "led", "incandescent", "halogen" }, }, { 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 = "enum", name = "backlight_mode", property = "backlight_mode", access = 3, description = "Mode of the backlight", category = "config", values = { "off", "normal", "inverted" }, }, } device.tuyaDatapoints = { { dp = 1, name = "state", converter = "onOff" }, { dp = 3, name = "brightness", converter = "scale0_254to0_1000" }, { dp = 4, name = "light_type", converter = "lightType" }, { dp = 5, name = "max_brightness", converter = "scale0_254to0_1000" }, { dp = 6, name = "countdown", converter = "countdown" }, { dp = 14, name = "power_on_behavior", converter = "powerOnBehavior" }, { dp = 21, name = "backlight_mode", converter = "backlightModeOffNormalInverted" }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE200_whpb9yts", }, } return device