Events¶
The events surface exposes two server-side event streams: PWS events (proximity / position) and zone events (entry / exit). PWS is paginated; zone events return as a flat list per window.
Quick reference¶
| Method | What it does |
|---|---|
client.events.iter_pws(*, tag_uids, start, end, page_size=1000) |
Lazy iterator over PWS events; fetches pages on demand. |
client.events.pages(*, ...) |
Same data, yields Page[PwsEvent] so callers can inspect totals. |
client.events.list_zone_events(start, end, *, area_uids, type="information") |
Zone entry / exit events in a window. |
Iterating PWS events¶
tag_uids accepts a single uid or a list.
For progress reporting:
for page in client.events.pages(tag_uids="t-1", start=start, end=end):
print(f"page {page.page_number}: {len(page.items)} events")
if page.total_count is not None:
print(f"total reported: {page.total_count}")
For windows that fit in memory, the materializing aggregate
client.reports.pws(...) is one method instead of a loop — see
Reports.
Zone events¶
client.events.list_zone_events(start, end, area_uids=[area.uid])
returns a list of ZoneEvent (each with zone_uid, tag_uid,
and event_type like "enter" / "exit"). area_uids takes a list.
Models — PwsEvent, ZoneEvent¶
PwsEvent:
| Field | Type | Notes |
|---|---|---|
uid |
str \| None |
Server-assigned. |
tag_uid |
str \| None |
The tag this event is about. |
zone_uid |
str \| None |
Zone context (if any). |
ts |
int \| float \| None |
Server timestamp (Unix ms). |
type |
str \| None |
Event sub-type. |
ZoneEvent has uid, zone_uid, tag_uid, event_type.
Related entities¶
- Tags: filter by
tag_uids. See Tags. - Zones:
list_zone_eventsis per-area; zone entry/exit attribution uses the Zone uid. - Reports: aggregate / CSV alternatives. See Reports.
See also¶
- Pagination — the three styles the SDK abstracts.
- Timestamps — Unix ms vs ISO-8601 wire format.
- Rate limiting — long iterations should handle 429.