rtls-sdk 0.6.2__tar.gz → 0.6.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/CHANGELOG.md +26 -0
  2. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/PKG-INFO +2 -2
  3. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/pyproject.toml +1 -1
  4. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/position.py +35 -5
  5. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/tags.py +40 -8
  6. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/.gitignore +0 -0
  7. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/LICENSE +0 -0
  8. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/README.md +0 -0
  9. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/__init__.py +0 -0
  10. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/_auth.py +0 -0
  11. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/_client.py +0 -0
  12. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/_envelope.py +0 -0
  13. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/_http.py +0 -0
  14. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/_logging.py +0 -0
  15. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/_pagination.py +0 -0
  16. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/_query.py +0 -0
  17. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/_time.py +0 -0
  18. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/_ws.py +0 -0
  19. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/compounds/__init__.py +0 -0
  20. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/compounds/auth.py +0 -0
  21. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/compounds/context.py +0 -0
  22. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/compounds/groups.py +0 -0
  23. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/compounds/nodes.py +0 -0
  24. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/compounds/reports.py +0 -0
  25. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/compounds/system.py +0 -0
  26. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/compounds/tags.py +0 -0
  27. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/compounds/users.py +0 -0
  28. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/compounds/zones.py +0 -0
  29. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/errors.py +0 -0
  30. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/__init__.py +0 -0
  31. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/_base.py +0 -0
  32. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/alarm.py +0 -0
  33. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/anchor.py +0 -0
  34. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/anchor_association.py +0 -0
  35. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/area.py +0 -0
  36. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/bulk.py +0 -0
  37. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/company.py +0 -0
  38. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/csv_blob.py +0 -0
  39. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/floorplan.py +0 -0
  40. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/group.py +0 -0
  41. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/heatmap.py +0 -0
  42. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/import_result.py +0 -0
  43. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/lsb_settings.py +0 -0
  44. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/network.py +0 -0
  45. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/node.py +0 -0
  46. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/node_params.py +0 -0
  47. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/notification.py +0 -0
  48. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/project.py +0 -0
  49. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/pws.py +0 -0
  50. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/report.py +0 -0
  51. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/schedule.py +0 -0
  52. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/session_context.py +0 -0
  53. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/site.py +0 -0
  54. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/subscriber.py +0 -0
  55. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/system.py +0 -0
  56. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/system_health.py +0 -0
  57. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/tag.py +0 -0
  58. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/tag_association.py +0 -0
  59. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/tag_template.py +0 -0
  60. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/user.py +0 -0
  61. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/ws/__init__.py +0 -0
  62. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/ws/_base.py +0 -0
  63. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/ws/alarm.py +0 -0
  64. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/ws/notify.py +0 -0
  65. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/ws/ota.py +0 -0
  66. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/ws/param_p.py +0 -0
  67. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/ws/position.py +0 -0
  68. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/ws/sensor.py +0 -0
  69. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/ws/user_msg.py +0 -0
  70. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/ws/zone_event.py +0 -0
  71. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/zone.py +0 -0
  72. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/models/zone_event.py +0 -0
  73. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/py.typed +0 -0
  74. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/__init__.py +0 -0
  75. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/_base.py +0 -0
  76. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/alarms.py +0 -0
  77. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/anchor_associations.py +0 -0
  78. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/anchors.py +0 -0
  79. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/areas.py +0 -0
  80. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/auth.py +0 -0
  81. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/companies.py +0 -0
  82. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/context.py +0 -0
  83. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/events.py +0 -0
  84. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/floorplans.py +0 -0
  85. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/groups.py +0 -0
  86. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/logger.py +0 -0
  87. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/lsb.py +0 -0
  88. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/messaging.py +0 -0
  89. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/network.py +0 -0
  90. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/nodes.py +0 -0
  91. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/notifications.py +0 -0
  92. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/projects.py +0 -0
  93. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/reports.py +0 -0
  94. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/schedules.py +0 -0
  95. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/sites.py +0 -0
  96. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/subscribers.py +0 -0
  97. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/system.py +0 -0
  98. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/tag_associations.py +0 -0
  99. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/user_messages.py +0 -0
  100. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/users.py +0 -0
  101. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/ws.py +0 -0
  102. {rtls_sdk-0.6.2 → rtls_sdk-0.6.3}/src/rtls_sdk/resources/zones.py +0 -0
@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.6.3] — 2026-09-10
11
+
12
+ ### Fixed
13
+
14
+ - `tags.last_position()` now parses the body the server actually sends.
15
+ `GET /trackable_objects/position_from_state/{uid}` nests the coordinates
16
+ under `position` and spells the area `sublocation_uid`; `Position` knew
17
+ only the embedded (`sl_uid`/`dev_id`/`mac`) and standalone
18
+ (`area_uid`/`trackable_uid`/`mac_address`) forms, so it produced a
19
+ `Position` with `x`/`y`/`z` all `None` — and, because models allow extra
20
+ keys, did so silently. Callers polling "has a fix been computed yet?" read
21
+ that as "no position" while the server was serving one. `Position` now
22
+ lifts the nested `position` object and maps `sublocation_uid` → `area_uid`
23
+ (explicit top-level values still win).
24
+ - `tags.last_position()` returns `None` instead of an all-`None` `Position`
25
+ when the body carries no coordinates — including `{}`, which the route
26
+ returns when its state worker is unreachable.
27
+
28
+ ### Notes
29
+
30
+ - `position_from_state` sends **no** timestamp, MAC or tag identity, so
31
+ `pos.ts` / `pos.mac_address` / `pos.tag_uid` are always `None` on a fix
32
+ from this call. It cannot answer "has the fix advanced?"; read the tag
33
+ object's own `position` property or the `pos` WebSocket channel for that.
34
+ Documented on the method and in `docs/entities/tags.md`.
35
+
10
36
  ## [0.6.2] — 2026-07-09
11
37
 
12
38
  ### Changed
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: rtls-sdk
3
- Version: 0.6.2
3
+ Version: 0.6.3
4
4
  Summary: Python SDK for the RTLS REST API
5
5
  Project-URL: Documentation, https://rtls-sdk.pages.dev
6
6
  Author: RTLS SDK Maintainers
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "rtls-sdk"
7
- version = "0.6.2"
7
+ version = "0.6.3"
8
8
  description = "Python SDK for the RTLS REST API"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,9 +1,18 @@
1
1
  """Position model with embedded-vs-standalone normalization.
2
2
 
3
- The server emits position data under two wire formats (RESEARCH §3):
3
+ The server emits position data under three wire formats:
4
4
 
5
5
  - **Embedded** inside a tag: ``sl_uid``, ``sl_id``, ``dev_id``, ``mac``, ``ts``.
6
6
  - **Standalone** under ``/positions``: ``area_uid``, ``trackable_uid``, ``mac_address``, ``ts``.
7
+ - **State**, from ``/trackable_objects/position_from_state/{uid}``: the
8
+ coordinates are NESTED under ``position``, the area key is
9
+ ``sublocation_uid``, and there is **no** ``ts``/``mac``/tag identity at all::
10
+
11
+ {"position": {"x": 3800, "y": 3800, "z": 1000},
12
+ "sublocation_uid": "Izuz…", "location_uid": "TR2D…"}
13
+
14
+ (rtls-frontend ``routes/trackable_objects/utils.js::getTrackablePositionFromState``;
15
+ documented in its ``docs/internal/api/trackable_objects.md``.)
7
16
 
8
17
  The SDK normalizes both into one canonical shape with the SDK-canonical
9
18
  field names. Callers see ``area_uid`` / ``tag_uid``, never the wire aliases.
@@ -24,10 +33,17 @@ class Position(_BaseModel):
24
33
  """A position fix for a tag.
25
34
 
26
35
  Field names are SDK-canonical. Wire-format aliases ``sl_uid`` /
27
- ``dev_id`` / ``mac`` (embedded) and ``trackable_uid`` (standalone) are
28
- rewritten at parse time so consumers don't need to know which endpoint
29
- produced the data. ``tag_uid`` is the SDK-canonical name for the
30
- server's ``trackable_uid`` / ``dev_id``.
36
+ ``dev_id`` / ``mac`` (embedded), ``trackable_uid`` (standalone) and the
37
+ nested ``position`` / ``sublocation_uid`` (state) are rewritten at parse
38
+ time so consumers don't need to know which endpoint produced the data.
39
+ ``tag_uid`` is the SDK-canonical name for the server's
40
+ ``trackable_uid`` / ``dev_id``.
41
+
42
+ A state-form fix carries coordinates and an area, and nothing else: its
43
+ ``ts``, ``mac_address`` and ``tag_uid`` are ``None`` because that endpoint
44
+ does not send them. Do not use it to reason about fix recency — read the
45
+ trackable object's own ``position`` property, or the ``pos`` WebSocket
46
+ channel, when you need a timestamp.
31
47
  """
32
48
 
33
49
  area_uid: str | None = None
@@ -48,9 +64,23 @@ class Position(_BaseModel):
48
64
 
49
65
  out = dict(data)
50
66
 
67
+ # State form: lift the nested `position` object up to the top level.
68
+ # Top-level coordinates win — only the state endpoint nests them, and
69
+ # a payload carrying both is not something any server sends today.
70
+ nested = out.get("position")
71
+ if isinstance(nested, dict):
72
+ for axis in ("x", "y", "z"):
73
+ if out.get(axis) is None and nested.get(axis) is not None:
74
+ out[axis] = nested[axis]
75
+ out.pop("position", None)
76
+
51
77
  # Wire-form → SDK-canonical renames.
52
78
  if "area_uid" not in out and "sl_uid" in out:
53
79
  out["area_uid"] = out["sl_uid"]
80
+ # State form spells the area `sublocation_uid` (the server's own wire
81
+ # key, kept verbatim by this endpoint).
82
+ if out.get("area_uid") is None and out.get("sublocation_uid") is not None:
83
+ out["area_uid"] = out["sublocation_uid"]
54
84
  # tag_uid <- standalone wire `trackable_uid`, else embedded `dev_id`.
55
85
  if out.get("tag_uid") is None:
56
86
  if out.get("trackable_uid") is not None:
@@ -14,6 +14,18 @@ from ..models import BulkResult, Position, Tag, TagTemplate
14
14
  from ._base import ResourceAPI
15
15
 
16
16
 
17
+ def _position_or_none(wire: dict[str, Any]) -> Position | None:
18
+ """Parse a position payload, collapsing a coordinate-less result to ``None``.
19
+
20
+ A body with no x, y or z carries no fix — whatever else it holds — and the
21
+ caller asked "where is this tag?", so ``None`` is the honest answer.
22
+ """
23
+ position = Position.from_wire(wire)
24
+ if position.x is None and position.y is None and position.z is None:
25
+ return None
26
+ return position
27
+
28
+
17
29
  class TagsAPI(ResourceAPI):
18
30
  """List, get, and (later) mutate trackables.
19
31
 
@@ -92,11 +104,31 @@ class TagsAPI(ResourceAPI):
92
104
  return [TagTemplate.from_wire(item) for item in items]
93
105
 
94
106
  def last_position(self, uid: str) -> Position | None:
95
- """Return the last cached position for a trackable, if known.
96
-
97
- The response envelope is ``{trackablePositionFromState}`` — a
98
- single position object, not a list (RESEARCH §3). Returns
99
- ``None`` if the server has no cached position.
107
+ """Return the last cached ("state") position for a tag, if known.
108
+
109
+ The response envelope is ``{trackablePositionFromState}`` — a single
110
+ position object, not a list — and the server sends ``null`` there when
111
+ it holds no fix. The object itself nests its coordinates::
112
+
113
+ {"trackablePositionFromState": {
114
+ "position": {"x": 3800, "y": 3800, "z": 1000},
115
+ "sublocation_uid": "Izuz…", "location_uid": "TR2D…"}}
116
+
117
+ :class:`~rtls_sdk.models.position.Position` flattens that on parse.
118
+
119
+ .. note::
120
+ This endpoint returns **no timestamp**, MAC or tag identity — only
121
+ coordinates and the area. ``pos.ts`` is therefore always ``None``
122
+ here, so this is not the call to use for "has the fix advanced?".
123
+ Read the tag object's own ``position`` property, or the ``pos``
124
+ WebSocket channel, for a timestamped fix.
125
+
126
+ Returns ``None`` when the server holds no position — including the
127
+ empty-object body (``{"trackablePositionFromState": {}}``) it sends
128
+ when the state worker is unreachable, and any body that yields no
129
+ coordinates at all. Never returns a ``Position`` with nothing in it:
130
+ an all-``None`` object reads as a real fix at the call site and is how
131
+ a nested-payload regression stayed invisible before.
100
132
  """
101
133
  response = self._get(f"/api/v2/trackable_objects/position_from_state/{uid}")
102
134
  payload = response.json()
@@ -104,10 +136,10 @@ class TagsAPI(ResourceAPI):
104
136
  return None
105
137
  for key in ("trackablePositionFromState", "trackable_position_from_state"):
106
138
  if key in payload and isinstance(payload[key], dict):
107
- return Position.from_wire(payload[key])
139
+ return _position_or_none(payload[key])
108
140
  # Some deployments return the position object directly.
109
- if "x" in payload or "ts" in payload:
110
- return Position.from_wire(payload)
141
+ if "x" in payload or "position" in payload or "ts" in payload:
142
+ return _position_or_none(payload)
111
143
  return None
112
144
 
113
145
  def create_raw(self, name: str, **fields: Any) -> Tag:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes