Add device info to Météo-France (#44457)

This commit is contained in:
Oncleben31 2021-01-01 01:51:03 +01:00 committed by GitHub
parent 12b7b2098d
commit 41ebfcdc9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 0 deletions

View File

@ -36,6 +36,8 @@ COORDINATOR_RAIN = "coordinator_rain"
COORDINATOR_ALERT = "coordinator_alert"
UNDO_UPDATE_LISTENER = "undo_update_listener"
ATTRIBUTION = "Data provided by Météo-France"
MODEL = "Météo-France mobile API"
MANUFACTURER = "Météo-France"
CONF_CITY = "city"
FORECAST_MODE_HOURLY = "hourly"

View File

@ -29,6 +29,8 @@ from .const import (
ENTITY_ICON,
ENTITY_NAME,
ENTITY_UNIT,
MANUFACTURER,
MODEL,
SENSOR_TYPES,
)
@ -94,6 +96,17 @@ class MeteoFranceSensor(CoordinatorEntity):
"""Return the name."""
return self._name
@property
def device_info(self):
"""Return the device info."""
return {
"identifiers": {(DOMAIN, self.platform.config_entry.unique_id)},
"name": self.coordinator.name,
"manufacturer": MANUFACTURER,
"model": MODEL,
"entry_type": "service",
}
@property
def state(self):
"""Return the state."""

View File

@ -28,6 +28,8 @@ from .const import (
DOMAIN,
FORECAST_MODE_DAILY,
FORECAST_MODE_HOURLY,
MANUFACTURER,
MODEL,
)
_LOGGER = logging.getLogger(__name__)
@ -83,6 +85,17 @@ class MeteoFranceWeather(CoordinatorEntity, WeatherEntity):
"""Return the name of the sensor."""
return self._city_name
@property
def device_info(self):
"""Return the device info."""
return {
"identifiers": {(DOMAIN, self.platform.config_entry.unique_id)},
"name": self.coordinator.name,
"manufacturer": MANUFACTURER,
"model": MODEL,
"entry_type": "service",
}
@property
def condition(self):
"""Return the current condition."""