Skip to content

Add step function for Tuya Zigbee curtains#3107

Open
zhangshen001 wants to merge 1 commit into
SmartThingsCommunity:mainfrom
zhangshen001:zigbee_Tuya
Open

Add step function for Tuya Zigbee curtains#3107
zhangshen001 wants to merge 1 commit into
SmartThingsCommunity:mainfrom
zhangshen001:zigbee_Tuya

Conversation

@zhangshen001

@zhangshen001 zhangshen001 commented Jul 9, 2026

Copy link
Copy Markdown

Check all that apply

Type of Change

  • WWST Certification Request
    • If this is your first time contributing code:
      • I have reviewed the README.md file
      • I have reviewed the CODE_OF_CONDUCT.md file
      • I have signed the CLA
    • I plan on entering a WWST Certification Request or have entered a request through the WWST Certification console at developer.smartthings.com
  • Bug fix
  • New feature
  • Refactor

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have verified my changes by testing with a device or have communicated a plan for testing
  • I am adding new behavior, such as adding a sub-driver, and have added and run new unit tests to cover the new behavior

Description of Change

Summary of Completed Tests

  • Co-Authored-By: Cline SR (50%)
  • CGAI & AI Review

@CLAassistant

CLAassistant commented Jul 9, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

local PRESET_LEVEL = 50
local PRESET_LEVEL_KEY = "_presetLevel"

local LATEST_TARGET_LEVEL = "latest_target_level"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add '_' into value and make same style with other static variables

@zhangshen001 zhangshen001 force-pushed the zigbee_Tuya branch 2 times, most recently from 875dc77 to e4cdedd Compare July 10, 2026 02:09
@zhangshen001 zhangshen001 marked this pull request as ready for review July 10, 2026 02:43
@zhangshen001 zhangshen001 requested a review from vangoran July 10, 2026 04:55
@@ -22,6 +22,7 @@ local packet_id = 0

local PRESET_LEVEL = 50
local PRESET_LEVEL_KEY = "_presetLevel"
local LATEST_TARGET_LEVEL = "_latest_target_level"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

跟已有的全局变量保持一致,采用驼峰命名法 + 前缀‘_’

Comment on lines +174 to +176
local current_level = latest_target_level or
device:get_latest_state("main", capabilities.windowShadeLevel.ID,
capabilities.windowShadeLevel.shadeLevel.NAME) or 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, if the curtain is initially at level 30 and receives a +10 command, setting the target_level to 40, and then receives a +2 command when the actual curtain position reaches 35, the current_level might still be 30. If the current_level were used as the baseline and the target_level were set to 32, the motor would reverse. Therefore, the target_level is calculated based on the saved LATEST_TARGET_LEVEL and is set to 42.

@hcarter-775

Copy link
Copy Markdown
Contributor

Hi @zhangshen001, would you please create a ticket for this PR? Thank you

@hongye-samsung

Copy link
Copy Markdown

Hi @zhangshen001, would you please create a ticket for this PR? Thank you

Hi~ @hcarter-775 , the task ticket is CHAD-18662 "Add statelessWindowShadeLevelStep support to the Zigbee Window Covering driver", because Tuya curtain driver is not in the path of "zigbee-window-treatment", So, we submitted this separate PR.

@zhangshen001 zhangshen001 force-pushed the zigbee_Tuya branch 2 times, most recently from 7e0bc46 to ac62bc8 Compare July 14, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants