Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Debounce #149

Merged
merged 7 commits into from
Dec 25, 2022
Merged

Debounce #149

merged 7 commits into from
Dec 25, 2022

Conversation

jimtng
Copy link
Collaborator

@jimtng jimtng commented Dec 17, 2022

Resolve #129 also boc-tothefuture#356

@jimtng jimtng requested a review from ccutrer December 17, 2022 11:04
@jimtng jimtng marked this pull request as draft December 17, 2022 12:47
@jimtng jimtng marked this pull request as ready for review December 17, 2022 14:05
@jimtng jimtng force-pushed the debounce branch 4 times, most recently from ec136f2 to 592a658 Compare December 18, 2022 00:27
@jimtng
Copy link
Collaborator Author

jimtng commented Dec 18, 2022

I've updated the PR:

  • Keep the debounce as is
  • only_every is basically a leading edge filter without any extra options. Add only_every as a simplified version of the debounce guard / method. This meets the simpler usage of only_every but also offer the full debounce feature when needed.
rule do
  updated X
  debounce for: 1.minute, leading: true # this supports extra parameters
  run {}
end

# or

rule do
  updated X
  only_every :minute # this doesn't support the extra parameters
  run {}
end

I think this is ready to be reviewed now.

@jimtng jimtng marked this pull request as draft December 18, 2022 09:48
@jimtng jimtng force-pushed the debounce branch 8 times, most recently from 25a7707 to 47b542b Compare December 20, 2022 10:39
@jimtng
Copy link
Collaborator Author

jimtng commented Dec 20, 2022

Waiting on #152

Copy link
Owner

@ccutrer ccutrer left a comment

Choose a reason for hiding this comment

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

Please only add additional commits as this point, instead of force-pushing. Once it's all approved, we'll squash together as necessary, preserving the lead-up cleanups, but squashing any changes to debouncer itself together.

lib/openhab/dsl.rb Outdated Show resolved Hide resolved
lib/openhab/dsl.rb Outdated Show resolved Hide resolved
lib/openhab/dsl/debouncer.rb Outdated Show resolved Hide resolved
lib/openhab/dsl/debouncer.rb Outdated Show resolved Hide resolved
lib/openhab/dsl.rb Outdated Show resolved Hide resolved
lib/openhab/dsl/debouncer.rb Show resolved Hide resolved
lib/openhab/dsl/rules/automation_rule.rb Outdated Show resolved Hide resolved
lib/openhab/dsl/rules/builder.rb Outdated Show resolved Hide resolved
lib/openhab/dsl/rules/builder.rb Outdated Show resolved Hide resolved
lib/openhab/dsl/rules/builder.rb Outdated Show resolved Hide resolved
@jimtng jimtng marked this pull request as ready for review December 23, 2022 00:31
@jimtng jimtng requested a review from ccutrer December 23, 2022 00:32
@jimtng jimtng force-pushed the debounce branch 3 times, most recently from 9bd9225 to d54d97e Compare December 23, 2022 05:42
Copy link
Owner

@ccutrer ccutrer left a comment

Choose a reason for hiding this comment

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

Fantastic work

lib/openhab/dsl/debouncer.rb Outdated Show resolved Hide resolved
spec/openhab/dsl/rules/builder_spec.rb Show resolved Hide resolved
@ccutrer
Copy link
Owner

ccutrer commented Dec 25, 2022

I squashed your last two commits together, changed the reset to be relative to now (instead of fixed at 1900) and fixed some minor formatting and grammar issues in docs.

@ccutrer ccutrer merged commit cf615de into ccutrer:main Dec 25, 2022
@jimtng jimtng deleted the debounce branch December 25, 2022 22:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debounce
2 participants