Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setCapabilityValue with duration option does not acknowledge duration option #55

Open
srussvoll opened this issue Jun 16, 2024 · 0 comments

Comments

@srussvoll
Copy link

srussvoll commented Jun 16, 2024

Calling the setCapabilityValue function as follows:

await Homey.devices.setCapabilityValue({
  deviceId: '[...]',
  capabilityId: 'dim',
  value: 1,
  opts: { duration: 10000 }
});

makes the light dim to 100 % immediately, not honoring the 10s duration option. The specific device I'm using is a Philips Hue White and Color with the Philips Hue without the bridge app as the driver. Checking the source code for that app, the duration option should be honored, which leads me to believe there is a bug in the setCapabilityValue function.


On a side note, running the corresponding flow card using the Web API works:

await this.webApi.flow.runFlowCardAction({
  id: `homey:device:[...]:dim`,
  uri: `homey:flowcardaction:homey:device:[...]:dim`,
  args: { dim: 1 },
  duration: 10,
});

How is the flow card implemented? What happens if a light does not support the "duration" capability option? Will the duration option simply not be honored, or is the flow card implementation able to detect this and not expose the duration option?

I'm currently running the runFlowCardAction function as a workaround. It is running inside an app on the Homey Pro, but the token I get from this.homey.api.getOwnerApiToken() does not have the scopes necessary to perform the runFlowCardAction call, so I have to use a token created in the Homey Web App, which is not ideal. Is there a way to get a token that has the necessary scopes directly from the app using the SDK? I noticed that if I change my app's name to "com.athom.homeyscript" I get a token with the scopes I need... Am I right in assuming that this behavior is reserved for Athom authored apps only?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant