Add service configuration URL to Speedtest.net (#57715)

pull/57736/head
Franck Nijhof 2021-10-15 00:37:31 +02:00 committed by GitHub
parent efb6300359
commit 4a20d28ec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -8,6 +8,7 @@ from homeassistant.components.speedtestdotnet import SpeedTestDataCoordinator
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.typing import StateType
@ -60,11 +61,12 @@ class SpeedtestSensor(CoordinatorEntity, RestoreEntity, SensorEntity):
self._attr_unique_id = description.key
self._state: StateType = None
self._attrs = {ATTR_ATTRIBUTION: ATTRIBUTION}
self._attr_device_info = {
"identifiers": {(DOMAIN, self.coordinator.config_entry.entry_id)},
"name": DEFAULT_NAME,
"entry_type": "service",
}
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, self.coordinator.config_entry.entry_id)},
name=DEFAULT_NAME,
entry_type="service",
configuration_url="https://www.speedtest.net/",
)
@property
def native_value(self) -> StateType: