feat(vividstorm): add screen controls and driver updates#2
feat(vividstorm): add screen controls and driver updates#2Simon-CR wants to merge 8 commits intoDrenso:mainfrom
Conversation
There was a problem hiding this comment.
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_upandvividstorm_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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
2ea5b30 to
6c2c303
Compare
There was a problem hiding this comment.
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.
81a4dd6 to
256b336
Compare
There was a problem hiding this comment.
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.
93f9ed6 to
16387cc
Compare
There was a problem hiding this comment.
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.
16387cc to
50cb3d5
Compare
There was a problem hiding this comment.
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
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. |
This is a pull request to add support for motorized raising projector screen. This device is handled like window covering for the most part.
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.