Models
Sleep
polar_flow.models.sleep.SleepData
Bases: BaseModel
Sleep tracking data for a single night.
This model represents sleep data returned by the Polar AccessLink API, including sleep stages, quality metrics, and physiological measurements.
sleep_efficiency
property
Percentage of time in bed actually sleeping.
Returns:
| Type | Description |
|---|---|
float
|
Sleep efficiency as a percentage (0-100) |
time_in_bed_hours
property
Total time in bed in hours.
Returns:
| Type | Description |
|---|---|
float
|
Time in bed in hours (rounded to 2 decimal places) |
time_in_bed_seconds
property
Total time in bed from sleep start to sleep end.
Returns:
| Type | Description |
|---|---|
int
|
Time in bed in seconds |
total_sleep_hours
property
Total sleep time in hours.
Returns:
| Type | Description |
|---|---|
float
|
Total sleep duration in hours (rounded to 2 decimal places) |
total_sleep_seconds
property
Total sleep time excluding interruptions.
Returns:
| Type | Description |
|---|---|
int
|
Total sleep duration in seconds |
get_sleep_quality()
Get human-readable sleep quality based on sleep score.
Returns:
| Type | Description |
|---|---|
str
|
Sleep quality description: Excellent, Good, Fair, or Poor |
parse_datetime(value)
classmethod
Parse ISO 8601 datetime string to datetime object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str | datetime
|
ISO 8601 datetime string or datetime object |
required |
Returns:
| Type | Description |
|---|---|
datetime
|
Parsed datetime object |
Raises:
| Type | Description |
|---|---|
ValueError
|
If datetime string is invalid |
Exercise
polar_flow.models.exercise.Exercise
Bases: BaseModel
Exercise (training session) data.
Represents a single training session/workout from a Polar device.
average_heart_rate
property
Average heart rate in BPM.
Returns:
| Type | Description |
|---|---|
int | None
|
Average HR or None |
distance_km
property
Distance in kilometers.
Returns:
| Type | Description |
|---|---|
float | None
|
Distance in km (rounded to 2 decimal places) or None |
duration_minutes
property
Exercise duration in minutes.
Returns:
| Type | Description |
|---|---|
float
|
Duration in minutes (rounded to 1 decimal place) |
duration_seconds
property
Parse ISO 8601 duration to seconds.
Returns:
| Type | Description |
|---|---|
int
|
Duration in seconds |
maximum_heart_rate
property
Maximum heart rate in BPM.
Returns:
| Type | Description |
|---|---|
int | None
|
Maximum HR or None |
parse_datetime(value)
classmethod
Parse ISO 8601 datetime string.
polar_flow.models.exercise.ExerciseSamples
Bases: BaseModel
Exercise samples data (HR, speed, cadence, etc.).
get_sample_by_type(sample_type)
Get sample by type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample_type
|
str
|
Sample type to find (e.g., 'HEARTRATE') |
required |
Returns:
| Type | Description |
|---|---|
ExerciseSample | None
|
Sample or None if not found |
polar_flow.models.exercise.ExerciseZones
Bases: BaseModel
Heart rate zones for exercise.
total_time_seconds
property
Total time across all zones.
Returns:
| Type | Description |
|---|---|
int
|
Total time in seconds |
Activity
polar_flow.models.activity.Activity
Bases: BaseModel
Daily activity summary with optional samples.
Represents a full day of activity data from a Polar device.
active_duration_minutes
property
Active duration in minutes.
Returns:
| Type | Description |
|---|---|
float
|
Active duration in minutes (rounded to 1 decimal place) |
active_duration_seconds
property
Parse ISO 8601 active duration to seconds.
Returns:
| Type | Description |
|---|---|
int
|
Active duration in seconds |
distance_km
property
Distance in kilometers.
Returns:
| Type | Description |
|---|---|
float
|
Distance in km (rounded to 2 decimal places) |
inactive_duration_minutes
property
Inactive duration in minutes.
Returns:
| Type | Description |
|---|---|
float
|
Inactive duration in minutes (rounded to 1 decimal place) |
inactive_duration_seconds
property
Parse ISO 8601 inactive duration to seconds.
Returns:
| Type | Description |
|---|---|
int
|
Inactive duration in seconds |
parse_datetime(value)
classmethod
Parse ISO 8601 datetime string.
Recharge
polar_flow.models.recharge.NightlyRecharge
Bases: BaseModel
Nightly recharge recovery data.
Represents autonomic nervous system (ANS) recovery and sleep quality metrics.
User
polar_flow.models.user.UserInfo
Bases: BaseModel
User information and profile data.
parse_datetime(value)
classmethod
Parse ISO 8601 datetime string.
Physical Information
polar_flow.models.physical_info.PhysicalInformation
Bases: BaseModel
Physical information entity with body metrics and fitness levels.
parse_datetime(value)
classmethod
Parse ISO 8601 datetime string.