local device = {} device.model = "TS0601_cover_6" device.vendor = "Tuya" device.description = "Cover motor" device.exposes = { { type = "text", name = "work_state", property = "work_state", access = 1, }, { 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 = "battery", property = "battery", access = 1, unit = "%", min = 0, max = 100, description = "Remaining battery in %, can take up to 24 hours before reported", category = "diagnostic", }, { type = "numeric", name = "illuminance", property = "illuminance", access = 1, unit = "%", description = "Measured illuminance", }, { type = "enum", name = "opening_mode", property = "opening_mode", access = 3, description = "Opening mode", values = { "tilt", "lift" }, }, { type = "enum", name = "motor_direction", property = "motor_direction", access = 3, description = "Motor side", values = { "left", "right" }, }, { type = "enum", name = "set_upper_limit", property = "set_upper_limit", access = 3, description = "Learning", values = { "start", "stop" }, }, { type = "enum", name = "factory_reset", property = "factory_reset", access = 3, description = "Remove limits", values = { "SET" }, }, } device.fromZigbee = { "battery", "illuminance" } 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 = 4, name = "opening_mode", converter = "lookup", lookup = { tilt = 0, lift = 1 } }, { dp = 7, name = "work_state", converter = "lookup", lookup = { standby = 0, success = 1, learning = 2 } }, { dp = 13, name = "battery", converter = "raw" }, { dp = 101, name = "motor_direction", converter = "lookup", lookup = { left = 0, right = 1 } }, { dp = 102, name = "set_upper_limit", converter = "lookup", lookup = { stop = 0, start = 1 } }, { dp = 104, name = "illuminance", converter = "raw" }, { dp = 107, name = "factory_reset", converter = "setLimit" }, } device.configure = { bind = { "genPowerCfg", "msIlluminanceMeasurement" }, reporting = { { cluster = "genPowerCfg", attribute = "batteryPercentageRemaining", min = 3600, max = 65000, change = 0, }, { cluster = "genPowerCfg", attribute = "batteryVoltage", min = 3600, max = 65000, change = 0, }, { cluster = "msIlluminanceMeasurement", attribute = "measuredValue", min = 10, max = 3600, change = 5, }, }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE200_cpbo62rn", }, { model = "TS0601", manufacturer = "_TZE200_libht6ua", }, { model = "TS0601", manufacturer = "_TZE284_libht6ua", }, } return device