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

Fix incorrect handling of openState in Contact Sensor #1061

Merged

Conversation

nzws
Copy link
Contributor

@nzws nzws commented Sep 26, 2024

♻️ Current situation

The Contact Sensor has three states: open, close, and timeOutNotClose1. timeOutNotClose indicating that the door/window has been open for an extended period. However, in the current implementation, the timeOutNotClose state is not handled correctly, causing the state to be incorrectly updated to close.

💡 Proposed solution

I modified the handling so that timeOutNotClose behaves the same as open state, and I created a private function for shared handling to prevent future bugs.

⚙️ Release Notes

  • Fix incorrect handling of openState in Contact Sensor

➕ Additional Information

Testing

Reviewer Nudging

Footnotes

  1. https://github.com/OpenWonderLabs/SwitchBotAPI/tree/main?tab=readme-ov-file#contact-sensor-1

@github-actions github-actions bot added enhancement New feature or request latest labels Sep 26, 2024
@donavanbecker donavanbecker changed the base branch from latest to beta-3.8.3 September 26, 2024 03:36
@donavanbecker donavanbecker merged commit da8b745 into OpenWonderLabs:beta-3.8.3 Sep 26, 2024
5 checks passed
@github-actions github-actions bot added the beta label Sep 26, 2024
@nzws nzws deleted the fix/contact-sensor-status branch September 26, 2024 03:56
donavanbecker added a commit that referenced this pull request Oct 9, 2024
## ♻️ Current situation

The Contact Sensor has three states: `open`, `close`, and
`timeOutNotClose`[^1]. `timeOutNotClose` indicating that the door/window
has been open for an extended period. However, in the current
implementation, the `timeOutNotClose` state is not handled correctly,
causing the state to be incorrectly updated to `close`.

## 💡 Proposed solution

I modified the handling so that `timeOutNotClose` behaves the same as
`open` state, and I created a private function for shared handling to
prevent future bugs.

## ⚙️ Release Notes

- Fix incorrect handling of openState in Contact Sensor

## ➕ Additional Information

### Testing

### Reviewer Nudging

[^1]:
https://github.com/OpenWonderLabs/SwitchBotAPI/tree/main?tab=readme-ov-file#contact-sensor-1

Co-authored-by: Donavan Becker <beckersmarthome@icloud.com>
donavanbecker added a commit that referenced this pull request Oct 9, 2024
- Fix incorrect handling of openState in Contact Sensor [#1061](#1061), Thanks [@nzws](https://github.com/nzws)
- Fix light level stuck at ma [#1066](#1066), Thanks [@4gra](https://github.com/4gra)
- Housekeeping and updated dependencies.

**Full Changelog**: v3.8.2...v3.8.3

Co-Authored-By: Donavan Becker <beckersmarthome@icloud.com>
donavanbecker added a commit that referenced this pull request Oct 9, 2024
- Fix incorrect handling of openState in Contact Sensor [#1061](#1061), Thanks [@nzws](https://github.com/nzws)
- Fix light level stuck at ma [#1066](#1066), Thanks [@4gra](https://github.com/4gra)
- Housekeeping and updated dependencies.

**Full Changelog**: v3.8.2...v3.8.3
@donavanbecker donavanbecker mentioned this pull request Oct 9, 2024
donavanbecker added a commit that referenced this pull request Oct 9, 2024
## [3.8.3](https://github.com/OpenWonderLabs/homebridge-switchbot/releases/tag/v3.8.3) (2024-10-09)

### What's Changed
- Fix incorrect handling of openState in Contact Sensor [#1061](#1061), Thanks [@nzws](https://github.com/nzws)
- Fix light level stuck at ma [#1066](#1066), Thanks [@4gra](https://github.com/4gra)
- Housekeeping and updated dependencies.

**Full Changelog**: v3.8.2...v3.8.3

---------

Co-authored-by: Yuzuki Aida <i@yuzu.sh>
Co-authored-by: Graham <4gra@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta enhancement New feature or request latest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants