Add DeviceInfo to trafikverket_weatherstation (#64083)

* Add DeviceInfo to trafikverket_weatherstation

* Correct DeviceInfo
This commit is contained in:
G Johansson 2022-01-14 12:42:59 +01:00 committed by GitHub
parent c1692a324b
commit 55143e240b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,6 +31,8 @@ from homeassistant.const import (
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.device_registry import DeviceEntryType
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.util import Throttle
@ -218,6 +220,14 @@ class TrafikverketWeatherStation(SensorEntity):
self._attr_unique_id = f"{entry_id}_{description.key}"
self._station = sensor_station
self._weather_api = weather_api
self._attr_device_info = DeviceInfo(
entry_type=DeviceEntryType.SERVICE,
identifiers={(DOMAIN, entry_id)},
manufacturer="Trafikverket",
model="v1.2",
name=sensor_station,
configuration_url="https://api.trafikinfo.trafikverket.se/",
)
self._weather: WeatherStationInfo | None = None
@Throttle(MIN_TIME_BETWEEN_UPDATES)