local device = {} device.model = "TS0601_cover_4" device.vendor = "Tuya" device.description = "Cover" 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 = "enum", name = "motor_direction", property = "motor_direction", access = 3, description = "Set the motor direction", values = { "normal", "reversed" }, }, { type = "numeric", name = "motor_speed", property = "motor_speed", access = 3, unit = "rpm", min = 0, max = 255, description = "Motor speed", }, { type = "enum", name = "opening_mode", property = "opening_mode", access = 3, description = "Opening mode", values = { "tilt", "lift" }, }, { type = "enum", name = "set_upper_limit", property = "set_upper_limit", access = 2, description = "Set the upper limit, to reset limits use factory_reset", values = { "SET" }, }, { type = "enum", name = "set_bottom_limit", property = "set_bottom_limit", access = 2, description = "Set the bottom limit, to reset limits use factory_reset", values = { "SET" }, }, { type = "binary", name = "factory_reset", property = "factory_reset", access = 2, value_on = true, value_off = false, description = "Factory reset the device", }, } device.tuyaDatapoints = { { dp = 1, name = "state", converter = "lookup", lookup = { OPEN = 0, STOP = 1, CLOSE = 2 } }, { dp = 2, name = "position", converter = "coverPosition" }, { dp = 3, name = "position", converter = "raw" }, { dp = 5, name = "motor_direction", converter = "tubularMotorDirection" }, { dp = 101, name = "opening_mode", converter = "lookup", lookup = { tilt = 0, lift = 1 } }, { dp = 102, name = "factory_reset", converter = "raw" }, { dp = 103, name = "set_upper_limit", converter = "setLimit" }, { dp = 104, name = "set_bottom_limit", converter = "setLimit" }, { dp = 105, name = "motor_speed", converter = "raw" }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE200_zah67ekd", }, { model = "TS0601", manufacturer = "_TZE200_icka1clh", }, } return device