local device = {} device.model = "TS0301_dual_rail" device.vendor = "Tuya" device.description = "Top-down bottom-up dual motor shade" device.exposes = { { type = "cover", description = "Bottom rail", endpoint = "bottom", features = { { type = "enum", name = "state", property = "state_bottom", access = 3, endpoint = "bottom", values = { "OPEN", "CLOSE", "STOP" }, }, { type = "numeric", name = "position", property = "position_bottom", access = 7, unit = "%", min = 0, max = 100, description = "Position of this cover", endpoint = "bottom", }, }, }, { type = "cover", description = "Top rail", endpoint = "top", features = { { type = "enum", name = "state", property = "state_top", access = 3, endpoint = "top", values = { "OPEN", "CLOSE", "STOP" }, }, { type = "numeric", name = "position", property = "position_top", access = 7, unit = "%", min = 0, max = 100, description = "Position of this cover", endpoint = "top", }, }, }, { 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", }, } device.fromZigbee = { "battery" } device.tuyaDatapoints = { { dp = 109, name = "state_bottom", converter = "lookup", lookup = { OPEN = 0, CLOSE = 1, STOP = 2 } }, { dp = 101, name = "position_bottom", converter = "coverPositionInverted" }, { dp = 102, name = "position_bottom", converter = "coverPositionInverted" }, { dp = 1, name = "state_top", converter = "lookup", lookup = { CLOSE = 0, OPEN = 1, STOP = 2 } }, { dp = 2, name = "position_top", converter = "coverPosition" }, { dp = 3, name = "position_top", converter = "coverPosition" }, { dp = 13, name = "battery", converter = "raw" }, } device.configure = { bind = { "genPowerCfg" }, reporting = { { cluster = "genPowerCfg", attribute = "batteryPercentageRemaining", min = 3600, max = 65000, change = 0, }, { cluster = "genPowerCfg", attribute = "batteryVoltage", min = 3600, max = 65000, change = 0, }, }, } device.meta = { multiEndpoint = true } device.fingerprint = { { model = "TS0301", manufacturer = "_TZE210_inpjmc0h", }, } return device