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

feat: Add rotation data to Philips Hue Tap Dial #6321

Merged
merged 10 commits into from Oct 27, 2023

Conversation

zansko
Copy link
Contributor

@zansko zansko commented Oct 21, 2023

const adjustedTime = direction === 'right' ? time : 256 - time;
const dialType = 'rotate';
const speed = adjustedTime <= 25 ? 'step' : adjustedTime <= 75 ? 'slow' : 'fast';
payload.action = `${button}_${dialType}_${direction}_${speed}`;
payload.time = adjustedTime;
payload.direction = direction;
payload.type = type;
Copy link
Owner

Choose a reason for hiding this comment

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

Please prefix these with action, e.g. action_direction

Copy link
Contributor Author

Choose a reason for hiding this comment

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

✔️

@@ -615,6 +615,9 @@ export const presets = {
// Specific
ac_frequency: () => new Numeric('ac_frequency', access.STATE).withLabel('AC frequency').withUnit('Hz').withDescription('Measured electrical AC frequency'),
action: (values: string[]) => new Enum('action', access.STATE, values).withDescription('Triggered action (e.g. a button click)'),
action_type: (values: string[]) => new Enum('action_type', access.STATE, values).withDescription('Type of the rotation, value in the first message is `step` and in the next messages value is `rotate`'),
Copy link
Owner

Choose a reason for hiding this comment

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

It is not needed to put them here as these are not generic, so in the definition exposes use e.g.

e.enum('action_type', access.STATE, ['step', 'rotate']).withDescription('Type of the rotation, value in the first message is `step` and in the next messages value is `rotate`')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Taken care of

@Koenkk Koenkk merged commit 0f145e3 into Koenkk:master Oct 27, 2023
1 check passed
@Koenkk
Copy link
Owner

Koenkk commented Oct 27, 2023

Thanks!

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.

None yet

2 participants