mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Update viaggiatreno component due to API changes (#56463)
This commit is contained in:
parent
c9e1a03fe2
commit
ef4b6d7bdf
@ -1,6 +1,7 @@
|
|||||||
"""Support for the Italian train system using ViaggiaTreno API."""
|
"""Support for the Italian train system using ViaggiaTreno API."""
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
import time
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import async_timeout
|
import async_timeout
|
||||||
@ -17,7 +18,7 @@ ATTRIBUTION = "Powered by ViaggiaTreno Data"
|
|||||||
VIAGGIATRENO_ENDPOINT = (
|
VIAGGIATRENO_ENDPOINT = (
|
||||||
"http://www.viaggiatreno.it/viaggiatrenonew/"
|
"http://www.viaggiatreno.it/viaggiatrenonew/"
|
||||||
"resteasy/viaggiatreno/andamentoTreno/"
|
"resteasy/viaggiatreno/andamentoTreno/"
|
||||||
"{station_id}/{train_id}"
|
"{station_id}/{train_id}/{timestamp}"
|
||||||
)
|
)
|
||||||
|
|
||||||
REQUEST_TIMEOUT = 5 # seconds
|
REQUEST_TIMEOUT = 5 # seconds
|
||||||
@ -94,7 +95,7 @@ class ViaggiaTrenoSensor(SensorEntity):
|
|||||||
self._name = name
|
self._name = name
|
||||||
|
|
||||||
self.uri = VIAGGIATRENO_ENDPOINT.format(
|
self.uri = VIAGGIATRENO_ENDPOINT.format(
|
||||||
station_id=station_id, train_id=train_id
|
station_id=station_id, train_id=train_id, timestamp=int(time.time()) * 1000
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user