Profiles (EEP)¶
enocean.protocol.eep.EEPId
dataclass
¶
EEPId(rorg: int, func: int, type: int)
An EnOcean Equipment Profile, e.g. D2-01-12: RORG 0xD2, FUNC 0x01, TYPE 0x12.
parse
classmethod
¶
parse(value: str | EEPId) -> EEPId
Parses 'D2-01-12' (case-insensitive, '-' or ':' separated); EEPId instances are returned unchanged.
enocean.protocol.eep.EEP
¶
EEP()
The EnOcean Equipment Profiles known to the library.
The definitions (enocean/protocol/profiles/) are generated from the official EnOcean Alliance specification. Only the index is read on construction; each profile is parsed the first time it is used. Packet.eep is the instance shared by all packets.
describe
¶
describe(
eep_id: EEPId | str,
) -> tuple[ProfileDescription, ...]
The fields of a profile, e.g. EEP().describe('D2-01-12').
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eep_id
|
EEPId | str
|
The profile, as an EEPId or a string such as 'D2-01-12'. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ProfileDescription, ...]
|
One ProfileDescription per variant (direction, command or other condition). |
Raises:
| Type | Description |
|---|---|
KeyError
|
Unknown profile. |
find_profile
¶
find_profile(
bitarray: list[bool],
eep_rorg: int,
rorg_func: int,
rorg_type: int,
direction: int | None = None,
command: int | None = None,
status: list[bool] | None = None,
) -> Element | None
The variant of a profile to decode or build a telegram with.
The one for command or direction when given, else the one whose conditions the telegram's data bits
(bitarray) and status bits match, else the first one.
Returns:
| Type | Description |
|---|---|
Element | None
|
The variant, None if the profile is unknown. |
get_values
¶
get_values(
profile: Element | None,
bitarray: list[bool],
status: list[bool],
) -> tuple[Iterable[str], dict[str, FieldValue]]
Get keys and values from bitarray.
set_values
¶
set_values(
profile: Element | None,
data: list[bool],
status: list[bool],
properties: Mapping[str, Any],
) -> tuple[list[bool], list[bool]]
Update data based on data contained in properties.
enocean.protocol.eep.ProfileDescription
dataclass
¶
ProfileDescription(
eep_id: EEPId,
description: str | None,
function: str | None,
direction: int | None,
command: int | None,
length: int | None,
fields: tuple[FieldDescription, ...],
)
One variant (per direction or command) of a profile.
field
¶
field(shortcut: str) -> FieldDescription
The field with this shortcut; raises StopIteration if the variant has none.
enocean.protocol.eep.FieldDescription
dataclass
¶
FieldDescription(
shortcut: str,
description: str | None,
kind: str,
offset: int,
size: int,
unit: str,
raw_range: tuple[float, float] | None = None,
scale: tuple[float, float] | None = None,
items: Mapping[int, str] = dict(),
ranges: tuple[tuple[int, int, str], ...] = (),
)
One field of a profile variant, as defined in the profile's XML.
enocean.protocol.eep.FieldValue
¶
Bases: TypedDict
A decoded EEP field, as found in Packet.parsed.