local device = {} device.model = "M3TYW-2.0-13" device.vendor = "Tuya" device.description = "Longsam M3 curtain motor" device.fingerprint = { { model = "TS0601", manufacturer = "_TZE204_xu4a5rhj", }, } device.exposes = { { type = "cover", features = { { type = "enum", name = "state", property = "state", access = 3, values = { "OPEN", "CLOSE", "STOP" }, }, { type = "numeric", name = "position", property = "position", access = 3, unit = "%", min = 0, max = 100, description = "Position of this cover", }, }, }, { type = "composite", name = "options", property = "options", access = 3, features = { { type = "numeric", name = "motor_speed", property = "motor_speed", access = 3, min = 0, max = 255, description = "Motor speed", }, { type = "binary", name = "reverse_direction", property = "reverse_direction", access = 3, value_on = true, value_off = false, description = "Reverse the motor direction", }, }, }, } device.tuyaDatapoints = { { dp = 1, name = "state", converter = "lookup", lookup = { OPEN = 0, CLOSE = 1, STOP = 2 } }, { dp = 2, name = "position", converter = "coverPosition" }, { dp = 3, name = "position", converter = "coverPosition" }, } return device