Skip to content

decode_entity_event_protobuf

Part of Protobuf helpers in the Python API reference.

Related guidance: how-to/protobuf-decode, reference/wire-formats.

Runnable examples: decode_public_protobuf.py.

from picogrid_ecn_client import decode_entity_event_protobuf

Decode one entity event from the supported protobuf subset.

def decode_entity_event_protobuf(
payload: bytes,
*,
integration: str,
category: EntityCategory,
maximum_payload_size: int = 1048576,
) -> EntityEvent
NameTypeDefaultDescription
payloadbytesSerialized protobuf payload.
integrationstrTopic-derived integration name.
categoryEntityCategoryTopic-derived entity category.
maximum_payload_sizeint1048576Inclusive payload limit in bytes, from 1024 through 16777216.
TypeDescription
EntityEventThe decoded typed entity event.
ExceptionDescription
ProtocolErrorIf the payload is malformed, lacks required fields, or disagrees with the typed category context.
ResourceLimitErrorIf the payload exceeds maximum_payload_size bytes.
ValidationErrorIf an input or decoded public field is invalid.

Source · protobuf.py

Version 0.2.0 · branch main