local device = {} device.model = "TS0601_cover_wzre8hu2" device.vendor = "Tuya" device.description = "Curtain motor/roller blind motor/window pusher/tubular motor (inverted position)" device.zigbeeModel = {} device.fingerprint = { { model = "TS0601", manufacturer = "_TZE204_wzre8hu2", }, } 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 = "numeric", name = "tilt", property = "tilt", access = 3, unit = "%", min = 0, max = 100, description = "Tilt angle of this cover", }, }, }, { type = "enum", name = "reverse_direction", property = "reverse_direction", access = 3, description = "Reverse the motor direction", values = { "forward", "back" }, }, } -- Position control goes over the Tuya EF00 cluster: this TS0601 has no -- WindowCovering cluster (0x0102) in its endpoints (in:[4,5,61184,0]), so the -- MCU only acts on EF00 datapoints. dp2 is the writable position setpoint, dp3 -- is the MCU's live position feedback stream. Both use the inverted mapping. -- Open/close/stop stays on EF00 dp1, tilt stays on EF00 dp21. device.tuyaDatapoints = { { dp = 1, name = "state", converter = "lookup", lookup = { OPEN = 0, STOP = 1, CLOSE = 2 } }, { dp = 2, name = "position", converter = "coverPositionInverted" }, { dp = 3, name = "position", converter = "coverPositionInverted" }, { dp = 5, name = "reverse_direction", converter = "lookup", lookup = { forward = 0, back = 1 } }, { dp = 21, name = "tilt", converter = "mapNumberRange", range = { 0, 180, 0, 100 } }, } return device