Skip to content

feat(vividstorm): add screen controls and driver updates#2

Open
Simon-CR wants to merge 8 commits intoDrenso:mainfrom
Simon-CR:feature/vividstorm
Open

feat(vividstorm): add screen controls and driver updates#2
Simon-CR wants to merge 8 commits intoDrenso:mainfrom
Simon-CR:feature/vividstorm

Conversation

@Simon-CR
Copy link
Copy Markdown

This is a pull request to add support for motorized raising projector screen. This device is handled like window covering for the most part.

  • Updated drivers/window_coverings/ (Added Vividstorm logic and locks)
  • Updated app.json (Action Taken: I manually added vividstorm_lock_up and vividstorm_lock_down capabilities and updated the window_coverings driver definition, as these were missing from your app.json source)
  • Added .homeycompose/capabilities/ definitions for Vividstorm
  • Included lib/ directory improvements/fixes
  • Included package-lock.json updates

due to api/authentication issues on my end with Tuya, I can't properly test this, hopefully it's as good to go as it can.

Copilot AI review requested due to automatic review settings December 19, 2025 12:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for Vividstorm motorized projector screens, treating them as window coverings with additional lock/limit-setting capabilities.

  • Added Vividstorm-specific capabilities (vividstorm_lock_up and vividstorm_lock_down) for setting screen limits
  • Enhanced error handling in device pairing with try-catch for cloud device retrieval
  • Improved performance by parallelizing device specification fetching during pairing

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
package-lock.json Updated various dependencies including Babel, fast-glob, eslint-config-prettier, and worker-timers packages
lib/TuyaOAuth2Driver.ts Added error handling for device retrieval failures and converted sequential device processing to parallel with Promise.all
lib/TuyaHaClient.ts Added null token check in refreshApiToken to prevent errors when token doesn't exist
drivers/window_coverings/driver.ts Added Vividstorm product ID filtering to include specific Vividstorm devices in window coverings driver
drivers/window_coverings/device.ts Registered capability listeners for Vividstorm lock up/down commands (contains duplicate registrations)
drivers/window_coverings/TuyaWindowCoveringsConstants.ts Added 'border' capability mapping to support Vividstorm screen controls
app.json Added vividstorm_lock_up and vividstorm_lock_down capability definitions to window_coverings driver
.homeycompose/capabilities/vividstorm_lock_up.json New capability definition file for lock up button
.homeycompose/capabilities/vividstorm_lock_down.json New capability definition file for lock down button

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/TuyaOAuth2Driver.ts Outdated
Comment thread drivers/window_coverings/device.ts Outdated
Comment thread drivers/window_coverings/TuyaWindowCoveringsConstants.ts Outdated
Comment thread .homeycompose/capabilities/vividstorm_lock_up.json Outdated
Comment thread .homeycompose/capabilities/vividstorm_lock_down.json Outdated
Comment thread app.json Outdated
Simon-CR and others added 2 commits December 19, 2025 07:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

drivers/window_coverings/driver.ts:39

  • The Vividstorm capabilities ('border', 'upper_limit', 'lower_limit') are mapped in WINDOW_COVERINGS_CAPABILITY_MAPPING but are not being dynamically added to devices during pairing. The current logic only adds capabilities that are in WINDOW_COVERINGS_CAPABILITIES.read_write. This means that Vividstorm devices won't automatically get the 'vividstorm_lock_up' and 'vividstorm_lock_down' capabilities during pairing, even though the device has these Tuya capabilities in its status.

You should add logic to check if the device is a Vividstorm product and conditionally add the vividstorm capabilities when the corresponding Tuya capabilities are present.

  onTuyaPairListDeviceProperties(
    device: TuyaDeviceResponse,
    specifications?: TuyaDeviceSpecificationResponse,
    dataPoints?: TuyaDeviceDataPointResponse,
  ): ListDeviceProperties {
    const props = super.onTuyaPairListDeviceProperties(device, specifications, dataPoints);

    for (const status of device.status) {
      const tuyaCapability = status.code;

      const homeyCapability = getFromMap(WINDOW_COVERINGS_CAPABILITY_MAPPING, tuyaCapability);
      if (constIncludes(WINDOW_COVERINGS_CAPABILITIES.read_write, tuyaCapability) && homeyCapability) {
        props.store.tuya_capabilities.push(tuyaCapability);
        props.capabilities.push(homeyCapability);
      }

      if (constIncludes(WINDOW_COVERINGS_CAPABILITIES.setting, tuyaCapability) || tuyaCapability === 'percent_state') {
        props.store.tuya_capabilities.push(tuyaCapability);
      }
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/TuyaOAuth2Driver.ts Outdated
Comment thread drivers/window_coverings/driver.ts
Comment thread drivers/window_coverings/device.ts Outdated
@Simon-CR Simon-CR marked this pull request as draft December 19, 2025 13:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app.json
Comment thread drivers/window_coverings/device.ts Outdated
Comment thread lib/TuyaOAuth2Driver.ts Outdated
Comment thread .homeycompose/capabilities/vividstorm_lock_up.json
Comment thread drivers/window_coverings/device.ts
Comment thread drivers/window_coverings/TuyaWindowCoveringsConstants.ts Outdated
Comment thread drivers/window_coverings/TuyaWindowCoveringsConstants.ts Outdated
Comment thread .homeycompose/capabilities/vividstorm_lock_down.json
Comment thread app.json
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 10 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app.json Outdated
Comment thread drivers/window_coverings/TuyaWindowCoveringsConstants.ts Outdated
Comment thread drivers/window_coverings/device.ts Outdated
Comment thread drivers/window_coverings/device.ts
Comment thread drivers/window_coverings/driver.ts Outdated
Comment thread lib/TuyaOAuth2Driver.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 10 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

drivers/window_coverings/driver.ts:39

  • The current implementation will only add 'vividstorm_lock_up' capability to Vividstorm devices during pairing (via the mapping from 'border'). The 'vividstorm_lock_down' capability needs to be explicitly added in this method when a Vividstorm device with the 'border' capability is detected. Consider adding logic after line 34 to check if the device is a Vividstorm product and if 'border' is present, then add 'vividstorm_lock_down' to props.capabilities as well.
  onTuyaPairListDeviceProperties(
    device: TuyaDeviceResponse,
    specifications?: TuyaDeviceSpecificationResponse,
    dataPoints?: TuyaDeviceDataPointResponse,
  ): ListDeviceProperties {
    const props = super.onTuyaPairListDeviceProperties(device, specifications, dataPoints);

    for (const status of device.status) {
      const tuyaCapability = status.code;

      const homeyCapability = getFromMap(WINDOW_COVERINGS_CAPABILITY_MAPPING, tuyaCapability);
      if (constIncludes(WINDOW_COVERINGS_CAPABILITIES.read_write, tuyaCapability) && homeyCapability) {
        props.store.tuya_capabilities.push(tuyaCapability);
        props.capabilities.push(homeyCapability);
      }

      if (constIncludes(WINDOW_COVERINGS_CAPABILITIES.setting, tuyaCapability) || tuyaCapability === 'percent_state') {
        props.store.tuya_capabilities.push(tuyaCapability);
      }
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app.json Outdated
Comment thread drivers/window_coverings/device.ts Outdated
Comment thread drivers/window_coverings/TuyaWindowCoveringsConstants.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 10 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app.json
Comment thread drivers/window_coverings/TuyaWindowCoveringsConstants.ts
Comment thread drivers/window_coverings/device.ts
Comment thread drivers/window_coverings/device.ts
Comment thread drivers/window_coverings/driver.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 10 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread drivers/window_coverings/driver.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 10 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread drivers/window_coverings/device.ts Outdated
Comment thread drivers/window_coverings/driver.ts Outdated
Simon-CR and others added 2 commits December 19, 2025 11:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 10 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/TuyaOAuth2Driver.ts Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Simon-CR Simon-CR marked this pull request as ready for review December 19, 2025 17:05
@bobvandevijver
Copy link
Copy Markdown
Member

Thank you for the PR so far; from a quick glance I already see a lot of changes that are either incomplete, incorrect or unneeded. However, we will see whether we can use your work and make it work generally within this app. This might take some time though.

@Simon-CR
Copy link
Copy Markdown
Author

Simon-CR commented Jan 7, 2026

Thank you for the PR so far; from a quick glance I already see a lot of changes that are either incomplete, incorrect or unneeded. However, we will see whether we can use your work and make it work generally within this app. This might take some time though.

Hi Bob, I'm not a coder, hopefully the code will still be less work than a full manual implementation.

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.

3 participants