Avoid use of datetime.utc*
methods deprecated in Python 3.12 (#93684)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
This commit is contained in:
parent
61c17291fb
commit
9da192c752
18 changed files with 57 additions and 54 deletions
|
@ -2,7 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from pytraccar import (
|
||||
|
@ -44,7 +44,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util import slugify
|
||||
from homeassistant.util import dt as dt_util, slugify
|
||||
|
||||
from . import DOMAIN, TRACKER_UPDATE
|
||||
from .const import (
|
||||
|
@ -334,7 +334,8 @@ class TraccarScanner:
|
|||
|
||||
async def import_events(self):
|
||||
"""Import events from Traccar."""
|
||||
start_intervel = datetime.utcnow()
|
||||
# get_reports_events requires naive UTC datetimes as of 1.0.0
|
||||
start_intervel = dt_util.utcnow().replace(tzinfo=None)
|
||||
events = await self._api.get_reports_events(
|
||||
devices=[device.id for device in self._devices],
|
||||
start_time=start_intervel,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue