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

New SubGHz protocol: Legrand doorbell #120

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

user890104
Copy link
Contributor

What's new

  • Added a new SubGHz protocol encoder and decoder for wireless doorbells. It seems to be used by many brands, but the most reputable brand is Legrand. Both the battery operated version and the AC powered version use the same protocol. It is a static code OOK, that repeats over and over. The receiver only needs to hear one complete message, in order to ring.

https://www.legrand.com/ecatalogue/en/catalog/products/comfort-radio-kit-wireless-chime-and-doorbell-round-white-100m-radio-range-and-15-melodies-094252

https://www.legrand.com/ecatalogue/en/catalog/products/comfort-radio-kit-230v-plug-in-chime-and-wireless-doorbell-round-white-100m-radio-range-and-15-melodies-094254


For the reviewer

  • I've uploaded the firmware with this patch to a device and verified its functionality
  • I've confirmed the bug to be fixed / feature to be stable

@user890104
Copy link
Contributor Author

After testing, it seems like the receiver needs to hear 2 messages in a short interval, and for some reason the SubGHz app does not repeat the message when holding down the Send option. Can somebody help with diagnosing this issue?

@Willy-JL
Copy link
Member

Willy-JL commented May 7, 2024

The subghz app, in the history helper, checks the received signal hash with last received hash, and if less than 500ms went by it ignores the same hash. That's probably what you're encountering. Not sure how to go about this one

@user890104
Copy link
Contributor Author

I was referring to sending, not receiving. It correctly adds the decoded message to the history list only once, but when sending it does not respect the .repeat parameter in the encoder struct, nor holding down the send button (like RM does in order to keep repeating).

@user890104
Copy link
Contributor Author

Clicking Send two times in a rapid succession seems to work around this bug, and triggers the doorbell receiver.

@user890104
Copy link
Contributor Author

There's a false positive with this file, so I'll need to make the checks more strict. Currently the spaces aren't measured at all, just the marks. Also the delta is quite high, 300 uS is very generous. I haven't seen any deviations of more than 50-100 uS.

Home doorbell raw bug.sub.txt

Also I see there's a linter used in CI, how do I make sure my code is properly formatted before pushing?

@Willy-JL
Copy link
Member

Willy-JL commented May 9, 2024

You can use ./fbt format format_py for the linter, or setup an IDE formatter on save (on vscode you can use ./fbt vscode_dist, other IDEs will be a manual setup, there's a clang format config in repo root)

@Willy-JL Willy-JL marked this pull request as draft May 12, 2024 08:12
@Willy-JL Willy-JL added the feature New feature or request label May 12, 2024
@user890104 user890104 force-pushed the subghz-protocol-legrand-doorbell branch 4 times, most recently from 0bf7e9c to 719a240 Compare May 19, 2024 11:45
@user890104 user890104 force-pushed the subghz-protocol-legrand-doorbell branch from 719a240 to 700ec9d Compare May 24, 2024 21:08
@user890104 user890104 force-pushed the subghz-protocol-legrand-doorbell branch from 700ec9d to 2525c97 Compare May 24, 2024 23:19
@user890104
Copy link
Contributor Author

Re-implemented the decoder and lowered the delta. Tested with the broken file, and with raw signal replayed from another Flipper, LGTM.

@user890104 user890104 marked this pull request as ready for review May 24, 2024 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants