Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions toonapi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import annotations

from dataclasses import dataclass
from datetime import datetime
from datetime import datetime, timezone
from typing import Any, Callable

from .const import (
Expand Down Expand Up @@ -105,7 +105,7 @@ class ThermostatInfo:
set_by_load_shifthing: int | None = None

last_updated_from_display: datetime | None = None
last_updated: datetime = datetime.utcnow()
last_updated: datetime = datetime.now(tz=timezone.utc).replace(tzinfo=None)

@property
def burner(self) -> bool | None:
Expand Down Expand Up @@ -214,7 +214,7 @@ def update_from_dict(self, data: dict[str, Any]) -> None:
self.last_updated_from_display,
convert_datetime,
)
self.last_updated = datetime.utcnow()
self.last_updated = datetime.now(tz=timezone.utc).replace(tzinfo=None)


@dataclass
Expand All @@ -240,7 +240,7 @@ class PowerUsage:
meter_produced_low: float | None = None

last_updated_from_display: datetime | None = None
last_updated: datetime = datetime.utcnow()
last_updated: datetime = datetime.now(tz=timezone.utc).replace(tzinfo=None)

@property
def day_usage(self) -> float | None:
Expand Down Expand Up @@ -318,7 +318,7 @@ def update_from_dict(self, data: dict[str, Any]) -> None:
self.last_updated_from_display,
convert_datetime,
)
self.last_updated = datetime.utcnow()
self.last_updated = datetime.now(tz=timezone.utc).replace(tzinfo=None)


@dataclass
Expand All @@ -334,7 +334,7 @@ class GasUsage:
meter: float | None = None

last_updated_from_display: datetime | None = None
last_updated: datetime = datetime.utcnow()
last_updated: datetime = datetime.now(tz=timezone.utc).replace(tzinfo=None)

def update_from_dict(self, data: dict[str, Any]) -> None:
"""Update this GasUsage object with data from a dictionary."""
Expand All @@ -354,7 +354,7 @@ def update_from_dict(self, data: dict[str, Any]) -> None:
self.last_updated_from_display,
convert_datetime,
)
self.last_update = datetime.utcnow()
self.last_update = datetime.now(tz=timezone.utc).replace(tzinfo=None)


@dataclass
Expand All @@ -371,7 +371,7 @@ class WaterUsage:
meter: float | None = None

last_updated_from_display: datetime | None = None
last_updated = datetime.utcnow()
last_updated = datetime.now(tz=timezone.utc).replace(tzinfo=None)

def update_from_dict(self, data: dict[str, Any]) -> None:
"""Update this WaterUsage object with data from a dictionary."""
Expand All @@ -393,7 +393,7 @@ def update_from_dict(self, data: dict[str, Any]) -> None:
self.last_updated_from_display,
convert_datetime,
)
self.last_update = datetime.utcnow()
self.last_update = datetime.now(tz=timezone.utc).replace(tzinfo=None)


class Status:
Expand All @@ -406,7 +406,7 @@ class Status:
water_usage: WaterUsage = WaterUsage()

last_updated_from_display: datetime | None = None
last_updated: datetime = datetime.utcnow()
last_updated: datetime = datetime.now(tz=timezone.utc).replace(tzinfo=None)
server_time: datetime | None = None

def __init__(self, agreement: Agreement):
Expand All @@ -429,6 +429,6 @@ def update_from_dict(self, data: dict[str, Any]) -> Status:
)
if "serverTime" in data:
self.server_time = convert_datetime(data["serverTime"])
self.last_updated = datetime.utcnow()
self.last_updated = datetime.now(tz=timezone.utc).replace(tzinfo=None)

return self