Skip to main content

saw-amtraker-client

Shared Amtraker API client for the Live Track passenger-rail integrations for Home Assistant: Live Track Amtrak, Live Track VIA Rail and Live Track Brightline.

Pure Python, no Home Assistant imports. Each integration declares it in manifest.json requirements.

Why this is a separate package

HACS permits only one integration per repository, so three integrations cannot share a folder. Vendoring the same client into three repositories is how three subtly different clients get written, so it ships as a dependency instead.

What it refuses to do, and why

Each refusal comes from a measurement against the live feed, not from caution.

Behaviour Reason
course_deg() always returns None the feed's direction is an eight-value octant string; converting "SW" to 225.0 invents precision the feed never carried
speed_kmh() returns None for Brightline, even when the field is non-zero measured 0.0 on every instance while trains covered 76-133 km at 44-77 mph. The field is unpopulated, not stationary
observed_at() returns None for Brightline its lastValTS advances every 30 s while the position changes every 60 s. It is a feed refresh clock, not an observation time
observed_at() returns None for Predeparture trains that field then carries a scheduled future departure
a finished train is handled by type the API returns a bare [] list, not the documented keyed object
HTTP 429 raises RateLimited a non-200 must never be recorded as "no data"
an empty User-Agent raises at construction the server blocks such requests, so failing here is clearer than an empty result later

A terminal snap - the feed resetting a finished train's position to its terminus - is detected by implied speed, not by a fixed distance. A flat distance threshold discards genuine movement: at 125 mph over the observed 180 s maximum interval a train legitimately covers 10 km.

Caching

/v3/trains takes no parameters and returns every provider, so N consumers would otherwise make N identical system-wide requests. One client instance serves all three providers from a single cached fetch.

Data attribution

Train data is provided by Amtraker and is licensed under the Open Data Commons Attribution License (ODC-By) v1.0.

Disclaimer

Independent project. Not affiliated with, endorsed by or connected to Amtrak, VIA Rail Canada or Brightline.

Licence

MIT.

Metadata

Release files for saw-livetrack 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for saw-livetrack 0.1.0
File Size Uploaded
saw_livetrack-0.1.0.tar.gz 20.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for saw-livetrack 0.1.0
File Interpreter ABI Platform
saw_livetrack-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.1 kB

Release files / saw_livetrack-0.1.0.tar.gz

Download URL saw_livetrack-0.1.0.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
12a034480f60d6da5ad9d30a8538fdfbd1929558ae522b1234245eb0aa62cd06
BLAKE2b-256 checksum
How to use checksums
ed97877f850100b213f8b1102f3d1ead275aec54b9cea7b727a7cb0e65091d76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / saw_livetrack-0.1.0-py3-none-any.whl

Download URL saw_livetrack-0.1.0-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d036cc3ed3375b5351a0fff86fceb923ca67f64713240e35b754ec3ad6c82d0f
BLAKE2b-256 checksum
How to use checksums
affe0a84c451c5a05f3733b5bb9fe7aadd548e892bb24704daba4723f9776079
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release history Release notifications | RSS feed

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page