Fix StationInfo not string in Trafikverket Train ()

This commit is contained in:
G Johansson 2022-04-16 17:08:54 +02:00 committed by GitHub
parent ad1241a116
commit f5318ef6c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,7 @@ import logging
from typing import Any from typing import Any
from pytrafikverket import TrafikverketTrain from pytrafikverket import TrafikverketTrain
from pytrafikverket.trafikverket_train import TrainStop from pytrafikverket.trafikverket_train import StationInfo, TrainStop
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
@ -166,8 +166,8 @@ class TrainSensor(SensorEntity):
self, self,
train_api: TrafikverketTrain, train_api: TrafikverketTrain,
name: str, name: str,
from_station: str, from_station: StationInfo,
to_station: str, to_station: StationInfo,
weekday: list, weekday: list,
departuretime: time | None, departuretime: time | None,
entry_id: str, entry_id: str,
@ -188,7 +188,7 @@ class TrainSensor(SensorEntity):
configuration_url="https://api.trafikinfo.trafikverket.se/", configuration_url="https://api.trafikinfo.trafikverket.se/",
) )
self._attr_unique_id = create_unique_id( self._attr_unique_id = create_unique_id(
from_station, to_station, departuretime, weekday from_station.name, to_station.name, departuretime, weekday
) )
async def async_update(self) -> None: async def async_update(self) -> None: