ESPHome
2026.11.0-dev
Loading...
Searching...
No Matches
esphome
components
remote_base
keeloq_protocol.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/component.h
"
4
#include "
remote_base.h
"
5
6
namespace
esphome::remote_base
{
7
8
struct
KeeloqData
{
9
uint32_t
encrypted
;
// 32 bit encrypted field
10
uint32_t
address
;
// 28 bit serial number
11
uint8_t
command
;
// Button Status S2-S1-S0-S3
12
bool
repeat
{
true
};
// Repeated command bit
13
bool
vlow
;
// Battery status bit
14
uint16_t
suffix
{0};
// Optional bits after the 66-bit HCS301 word
15
uint8_t
suffix_bits
{0};
16
17
// Jarolift TDEF sends 8 group bits after the 64-bit word where the HCS301 has vlow and repeat.
18
void
set_group
(uint8_t
group
) {
19
this->vlow =
group
& 0x01;
20
this->
repeat
= group & 0x02;
21
this->
suffix
= group >> 2;
22
this->
suffix_bits
= 6;
23
}
24
// Only a Jarolift TDEF frame (suffix_bits == 6) carries a group; check suffix_bits before using it.
25
uint8_t
group
()
const
{
return
static_cast<
uint8_t
>
((this->
suffix
<< 2) | (this->
repeat
<< 1) | this->
vlow
); }
26
27
bool
operator==
(
const
KeeloqData
&rhs)
const
{
28
// 0x10 matches any command. The suffix is not compared: the binary sensor does not take it.
29
if
(
address
!= rhs.
address
) {
30
return
false
;
31
}
32
return
(rhs.
command
== 0x10 ||
command
== rhs.
command
);
33
}
34
};
35
36
class
KeeloqProtocol
:
public
RemoteProtocol
<KeeloqData> {
37
public
:
38
void
encode
(
RemoteTransmitData
*dst,
const
KeeloqData
&data);
39
optional<KeeloqData>
decode
(
RemoteReceiveData
src
);
40
void
dump
(
const
KeeloqData
&data);
41
};
42
43
DECLARE_REMOTE_PROTOCOL(Keeloq)
44
45
}
// namespace esphome::remote_base
esphome::remote_base::KeeloqProtocol
Definition
keeloq_protocol.h:36
esphome::remote_base::KeeloqProtocol::encode
void encode(RemoteTransmitData *dst, const KeeloqData &data)
Definition
keeloq_protocol.cpp:40
esphome::remote_base::KeeloqProtocol::decode
optional< KeeloqData > decode(RemoteReceiveData src)
Definition
keeloq_protocol.cpp:120
esphome::remote_base::KeeloqProtocol::dump
void dump(const KeeloqData &data)
Definition
keeloq_protocol.cpp:241
esphome::remote_base::RemoteProtocol
Definition
remote_base.h:390
esphome::remote_base::RemoteReceiveData
Definition
remote_base.h:88
esphome::remote_base::RemoteTransmitData
Definition
remote_base.h:39
component.h
esphome::remote_base
Definition
ir_rf_base.cpp:222
esphome::src
const void * src
Definition
hal.h:68
remote_base.h
uint32_t
static void uint32_t
Definition
crash_handler.cpp:153
esphome::remote_base::KeeloqData
Definition
keeloq_protocol.h:8
esphome::remote_base::KeeloqData::vlow
bool vlow
Definition
keeloq_protocol.h:13
esphome::remote_base::KeeloqData::suffix_bits
uint8_t suffix_bits
Definition
keeloq_protocol.h:15
esphome::remote_base::KeeloqData::address
uint32_t address
Definition
keeloq_protocol.h:10
esphome::remote_base::KeeloqData::set_group
void set_group(uint8_t group)
Definition
keeloq_protocol.h:18
esphome::remote_base::KeeloqData::group
uint8_t group() const
Definition
keeloq_protocol.h:25
esphome::remote_base::KeeloqData::repeat
bool repeat
Definition
keeloq_protocol.h:12
esphome::remote_base::KeeloqData::command
uint8_t command
Definition
keeloq_protocol.h:11
esphome::remote_base::KeeloqData::suffix
uint16_t suffix
Definition
keeloq_protocol.h:14
esphome::remote_base::KeeloqData::encrypted
uint32_t encrypted
Definition
keeloq_protocol.h:9
esphome::remote_base::KeeloqData::operator==
bool operator==(const KeeloqData &rhs) const
Definition
keeloq_protocol.h:27
Generated by
1.12.0