From 55143e240b0032989729b16624c4d0dd57b8f98c Mon Sep 17 00:00:00 2001 From: G Johansson Date: Fri, 14 Jan 2022 12:42:59 +0100 Subject: [PATCH] Add DeviceInfo to trafikverket_weatherstation (#64083) * Add DeviceInfo to trafikverket_weatherstation * Correct DeviceInfo --- .../components/trafikverket_weatherstation/sensor.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/homeassistant/components/trafikverket_weatherstation/sensor.py b/homeassistant/components/trafikverket_weatherstation/sensor.py index 7aa4b6c96e3..92211b4d681 100644 --- a/homeassistant/components/trafikverket_weatherstation/sensor.py +++ b/homeassistant/components/trafikverket_weatherstation/sensor.py @@ -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)