local device = {} device.model = "TS0601_dimmer_5" device.vendor = "Tuya" device.description = "1 gang smart dimmer module" 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 = "min_brightness", property = "min_brightness", access = 3, min = 1, max = 255, description = "Minimum light brightness", }, { type = "numeric", name = "max_brightness", property = "max_brightness", access = 3, min = 1, max = 255, description = "Maximum light brightness", }, }, }, { type = "enum", name = "power_on_behavior", property = "power_on_behavior", access = 3, values = { "off", "on", "previous" }, }, { 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 = "switch_type", property = "switch_type", access = 7, description = "Type of the switch", category = "config", values = { "toggle", "state", "momentary" }, }, } device.tuyaDatapoints = { { dp = 1, name = "state", converter = "onOff" }, { dp = 2, name = "brightness", converter = "scale0_254to0_1000" }, { dp = 3, name = "min_brightness", converter = "scale0_254to0_1000" }, { dp = 4, name = "light_type", converter = "lookup", lookup = { led = 0, incandescent = 1, halogen = 2 } }, { 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 = "lookup", lookup = { off = 0, on = 1, previous = 2 } }, { dp = 57, name = "switch_type", converter = "lookup", lookup = { toggle = 0, state = 1, momentary = 2 } }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE204_dcnsggvz", }, { model = "TS0601", manufacturer = "_TZE200_dcnsggv", }, { model = "TS0601", manufacturer = "_TZE200_dcnsggvz", }, } return device