esphome
esphome copied to clipboard
Keeloq
What does this implement/fix?
This adds an implementation of a decoder for the Keeloq protocol
Types of changes
- [ ] Bugfix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Other
Related issue or feature (if applicable): fixes
Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#<esphome-docs PR number goes here>
Test Environment
- [ ] ESP32
- [ ] ESP32 IDF
- [ ] ESP8266
- [X] STM32 (Only hardware I have that has a radio at 403.92MHz)
NB: This decoder is carrier frequency independent, and should work just fine at 433.92MHz too!
Example entry for config.yaml:
# Example config.yaml
keeloq_normal_crypter:
id: keeloq_crypter
# e.g. keeloq_manufacturer_key: 0x0123456789abcdef
manufacturer_key: !secret keeloq_manufacturer_key
text_sensor:
- platform: template
name: "Keeloq Remote"
id: keeloq_remote
remote_receiver:
id: receiver
pin:
number: PA_3
mode: INPUT
buffer_size: 200
tolerance: 30%
# dump: keeloq
on_keeloq:
then:
- lambda: |-
char buff[20];
if (id(keeloq_crypter).decrypt(x)) {
snprintf(buff, sizeof(buff), "%07x:%1x:%04X:%c:%c",
x.serial, x.button, x.sync, x.low ? 'L' : 'N', x.repeat ? 'R' : 'F');
} else {
snprintf(buff, sizeof(buff), "%07x:%1x::%c:%c",
x.serial, x.button, x.low ? 'L' : 'N', x.repeat ? 'R' : 'F');
}
std::string buffAsStdStr = buff;
id(keeloq_remote).publish_state(buff);
Checklist:
- [X] The code change is tested and works locally.
- [ ] Tests have been added to verify that the new code works (under
tests/folder).
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated in esphome-docs.
Hey there @RoganDawes,
Thanks for submitting this pull request! Can you add yourself as a codeowner for this integration? This way we can notify you if a bug report for this integration is reported.
In __init__.py of the integration, please add:
CODEOWNERS = ["@RoganDawes"]
And run script/build_codeowners.py
(message by NeedsCodeownersLabel)
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.